tReplace spaces with tabs (sue me!) - hadarawgs - Hadara adaptation for boardgamearena.com
 (HTM) git clone git://git.z3bra.org/hadarawgs.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 0b799c77b31490234808ceafb4a32b877e788ab4
 (DIR) parent 88b19b09ed37ca88f2c9fbaa31a78296bc7e1cf8
 (HTM) Author: Willy Goiffon <dev@z3bra.org>
       Date:   Mon,  2 Mar 2020 11:52:56 +0100
       
       Replace spaces with tabs (sue me!)
       
       Diffstat:
         M gameinfos.inc.php                   |      43 ++++++++++++++-----------------
         M gameoptions.inc.php                 |      51 +++++++++++++------------------
         M hadarawgs.action.php                |      72 +++++++++++++------------------
         M hadarawgs.css                       |       4 ----
         M hadarawgs.game.php                  |     516 ++++++++++++++++---------------
         M hadarawgs.js                        |     475 +++++++++++++++----------------
         M hadarawgs.view.php                  |      73 ++++++++++++++-----------------
         M material.inc.php                    |      11 +++++------
         M states.inc.php                      |     168 ++++++++++++++++----------------
         M stats.inc.php                       |     130 +++++++++++++++----------------
         M version.php                         |       2 +-
       
       11 files changed, 751 insertions(+), 794 deletions(-)
       ---
 (DIR) diff --git a/gameinfos.inc.php b/gameinfos.inc.php
       t@@ -1,13 +1,10 @@
        <?php
        
        /*
       -    From this file, you can edit the various meta-information of your game.
       -
       -    Once you modified the file, don't forget to click on "Reload game informations" from the Control Panel in order in can be taken into account.
       -
       -    See documentation about this file here:
       -    http://en.doc.boardgamearena.com/Game_meta-information:_gameinfos.inc.php
       -
       + * From this file, you can edit the various meta-information of your game.
       + * Once you modified the file, don't forget to click on "Reload game informations" from the Control Panel in order in can be taken into account.
       + * See documentation about this file here:
       + * http://en.doc.boardgamearena.com/Game_meta-information:_gameinfos.inc.php
        */
        
        $gameinfos = array(
       t@@ -28,13 +25,13 @@ $gameinfos = array(
        'publisher' => 'Hans im Glück',
        
        // Url of game publisher website
       -'publisher_website' => 'http://www.mypublishingcompany.com/',
       +'publisher_website' => 'https://www.hans-im-glueck.de/',
        
        // Board Game Geek ID of the publisher
       -'publisher_bgg_id' => 1234,
       +'publisher_bgg_id' => 133,
        
        // Board game geek ID of the game
       -'bgg_id' => 54321,
       +'bgg_id' => 269144,
        
        
        // Players configuration that can be played (ex: 2 to 4 players)
       t@@ -85,10 +82,10 @@ $gameinfos = array(
        'luck' => 3,
        
        // Strategy of the game, from 0 (no strategy can be setup) to 5 (totally based on strategy)
       -'strategy' => 3,
       +'strategy' => 4,
        
        // Diplomacy of the game, from 0 (no interaction in this game) to 5 (totally based on interaction and discussion between players)
       -'diplomacy' => 3,
       +'diplomacy' => 1,
        
        // Colors attributed to players
        'player_colors' => array( "ff0000", "008000", "0000ff", "ffa500", "773300" ),
       t@@ -107,17 +104,17 @@ $gameinfos = array(
        // Note: game interface = space on the left side, without the column on the right
        'game_interface_width' => array(
        
       -    // Minimum width
       -    //  default: 740
       -    //  maximum possible value: 740 (ie: your game interface should fit with a 740px width (correspond to a 1024px screen)
       -    //  minimum possible value: 320 (the lowest value you specify, the better the display is on mobile)
       -    'min' => 740,
       -
       -    // Maximum width
       -    //  default: null (ie: no limit, the game interface is as big as the player's screen allows it).
       -    //  maximum possible value: unlimited
       -    //  minimum possible value: 740
       -    'max' => null
       +        // Minimum width
       +        //  default: 740
       +        //  maximum possible value: 740 (ie: your game interface should fit with a 740px width (correspond to a 1024px screen)
       +        //  minimum possible value: 320 (the lowest value you specify, the better the display is on mobile)
       +        'min' => 540,
       +
       +        // Maximum width
       +        //  default: null (ie: no limit, the game interface is as big as the player's screen allows it).
       +        //  maximum possible value: unlimited
       +        //  minimum possible value: 740
       +        'max' => null
        ),
        
        // Game presentation
 (DIR) diff --git a/gameoptions.inc.php b/gameoptions.inc.php
       t@@ -12,9 +12,9 @@
         * gameoptions.inc.php
         *
         * hadarawgs game options description
       - * 
       + *
         * In this file, you can define your game options (= game variants).
       - *   
       + *
         * Note: If your game has no variant, you don't have to modify this file.
         *
         * Note²: All options defined in this file should have a corresponding "game state labels"
       t@@ -25,31 +25,24 @@
         */
        
        $game_options = array(
       -
       -    /*
       -    
       -    // note: game variant ID should start at 100 (ie: 100, 101, 102, ...). The maximum is 199.
       -    100 => array(
       -                'name' => totranslate('my game option'),    
       -                'values' => array(
       -
       -                            // A simple value for this option:
       -                            1 => array( 'name' => totranslate('option 1') )
       -
       -                            // A simple value for this option.
       -                            // If this value is chosen, the value of "tmdisplay" is displayed in the game lobby
       -                            2 => array( 'name' => totranslate('option 2'), 'tmdisplay' => totranslate('option 2') ),
       -
       -                            // Another value, with other options:
       -                            //  description => this text will be displayed underneath the option when this value is selected to explain what it does
       -                            //  beta=true => this option is in beta version right now.
       -                            //  nobeginner=true  =>  this option is not recommended for beginners
       -                            3 => array( 'name' => totranslate('option 3'), 'description' => totranslate('this option does X'), 'beta' => true, 'nobeginner' => true )
       -                        )
       -            )
       -
       -    */
       -
       +        /*
       +        // note: game variant ID should start at 100 (ie: 100, 101, 102, ...). The maximum is 199.
       +        100 => array(
       +                'name' => totranslate('my game option'),
       +                'values' => array(
       +                        // A simple value for this option:
       +                        1 => array( 'name' => totranslate('option 1') )
       +
       +                        // A simple value for this option.
       +                        // If this value is chosen, the value of "tmdisplay" is displayed in the game lobby
       +                        2 => array( 'name' => totranslate('option 2'), 'tmdisplay' => totranslate('option 2') ),
       +
       +                        // Another value, with other options:
       +                        //  description => this text will be displayed underneath the option when this value is selected to explain what it does
       +                        //  beta=true => this option is in beta version right now.
       +                        //  nobeginner=true  =>  this option is not recommended for beginners
       +                        3 => array( 'name' => totranslate('option 3'), 'description' => totranslate('this option does X'), 'beta' => true, 'nobeginner' => true )
       +                )
       +        )
       +        */
        );
       -
       -
 (DIR) diff --git a/hadarawgs.action.php b/hadarawgs.action.php
       t@@ -7,7 +7,7 @@
         * This code has been produced on the BGA studio platform for use on https://boardgamearena.com.
         * See http://en.doc.boardgamearena.com/Studio for more information.
         * -----
       - * 
       + *
         * hadarawgs.action.php
         *
         * hadarawgs main action entry point
       t@@ -15,54 +15,44 @@
         *
         * In this file, you are describing all the methods that can be called from your
         * user interface logic (javascript).
       - *       
       + *
         * If you define a method "myAction" here, then you can call it from your javascript code with:
         * this.ajaxcall( "/hadarawgs/hadarawgs/myAction.html", ...)
         *
         */
       -  
       -  
       -  class action_hadarawgs extends APP_GameAction
       -  { 
       -    // Constructor: please do not modify
       -           public function __default()
       -          {
       -              if( self::isArg( 'notifwindow') )
       -              {
       -            $this->view = "common_notifwindow";
       -                  $this->viewArgs['table'] = self::getArg( "table", AT_posint, true );
       -              }
       -              else
       -              {
       -            $this->view = "hadarawgs_hadarawgs";
       -            self::trace( "Complete reinitialization of board game" );
       -      }
       -          } 
       -          
       -          // TODO: defines your action entry points there
        
       +class action_hadarawgs extends APP_GameAction
       +{
       +        // Constructor: please do not modify
       +        public function __default()
       +        {
       +                if( self::isArg( 'notifwindow') ) {
       +                        $this->view = "common_notifwindow";
       +                        $this->viewArgs['table'] = self::getArg( "table", AT_posint, true );
       +                } else {
       +                        $this->view = "hadarawgs_hadarawgs";
       +                        self::trace( "Complete reinitialization of board game" );
       +                  }
       +        }
        
       -    /*
       -    
       -    Example:
       -          
       -    public function myAction()
       -    {
       -        self::setAjaxMode();     
       +        // TODO: defines your action entry points there
        
       -        // Retrieve arguments
       -        // Note: these arguments correspond to what has been sent through the javascript "ajaxcall" method
       -        $arg1 = self::getArg( "myArgument1", AT_posint, true );
       -        $arg2 = self::getArg( "myArgument2", AT_posint, true );
        
       -        // Then, call the appropriate method in your game logic, like "playCard" or "myAction"
       -        $this->game->myAction( $arg1, $arg2 );
       +        /*
       +        Example:
       +        public function myAction()
       +        {
       +                self::setAjaxMode();
        
       -        self::ajaxResponse( );
       -    }
       -    
       -    */
       +                // Retrieve arguments
       +                // Note: these arguments correspond to what has been sent through the javascript "ajaxcall" method
       +                $arg1 = self::getArg( "myArgument1", AT_posint, true );
       +                $arg2 = self::getArg( "myArgument2", AT_posint, true );
        
       -  }
       -  
       +                // Then, call the appropriate method in your game logic, like "playCard" or "myAction"
       +                $this->game->myAction( $arg1, $arg2 );
        
       +                self::ajaxResponse( );
       +        }
       +        */
       +}
 (DIR) diff --git a/hadarawgs.css b/hadarawgs.css
       t@@ -53,7 +53,3 @@
                background-repeat: none;
            }
        */
       -
       -
       -
       -
 (DIR) diff --git a/hadarawgs.game.php b/hadarawgs.game.php
       t@@ -3,11 +3,11 @@
          *------
          * BGA framework: © Gregory Isabelli <gisabelli@boardgamearena.com> & Emmanuel Colin <ecolin@boardgamearena.com>
          * hadarawgs implementation : © Willy Goiffon <dev@z3bra.org>
       -  * 
       +  *
          * This code has been produced on the BGA studio platform for use on http://boardgamearena.com.
          * See http://en.boardgamearena.com/#!doc/Studio for more information.
          * -----
       -  * 
       +  *
          * hadarawgs.game.php
          *
          * This is the main file for your game logic.
       t@@ -19,145 +19,147 @@
        
        require_once( APP_GAMEMODULE_PATH.'module/table/table.game.php' );
        
       -
        class hadarawgs extends Table
        {
                function __construct( )
                {
       -        // Your global variables labels:
       -        //  Here, you can assign labels to global variables you are using for this game.
       -        //  You can use any number of global variables with IDs between 10 and 99.
       -        //  If your game has options (variants), you also have to associate here a label to
       -        //  the corresponding ID in gameoptions.inc.php.
       -        // Note: afterwards, you can get/set the global variables with getGameStateValue/setGameStateInitialValue/setGameStateValue
       -        parent::__construct();
       -        
       -        self::initGameStateLabels( array( 
       -            //    "my_first_global_variable" => 10,
       -            //    "my_second_global_variable" => 11,
       -            //      ...
       -            //    "my_first_game_variant" => 100,
       -            //    "my_second_game_variant" => 101,
       -            //      ...
       -        ) );        
       +                // Your global variables labels:
       +                //  Here, you can assign labels to global variables you are using for this game.
       +                //  You can use any number of global variables with IDs between 10 and 99.
       +                //  If your game has options (variants), you also have to associate here a label to
       +                //  the corresponding ID in gameoptions.inc.php.
       +                // Note: afterwards, you can get/set the global variables with getGameStateValue/setGameStateInitialValue/setGameStateValue
       +                parent::__construct();
       +
       +                self::initGameStateLabels( array(
       +                        //    "my_first_global_variable" => 10,
       +                        //    "my_second_global_variable" => 11,
       +                        //      ...
       +                        //    "my_first_game_variant" => 100,
       +                        //    "my_second_game_variant" => 101,
       +                        //      ...
       +                ) );
                }
       -        
       -    protected function getGameName( )
       -    {
       +
       +        protected function getGameName( )
       +        {
                        // Used for translations and stuff. Please do not modify.
       -        return "hadarawgs";
       -    }        
       -
       -    /*
       -        setupNewGame:
       -        
       -        This method is called only once, when a new game is launched.
       -        In this method, you must setup the game according to the game rules, so that
       -        the game is ready to be played.
       -    */
       -    protected function setupNewGame( $players, $options = array() )
       -    {    
       -        // Set the colors of the players with HTML color code
       -        // The default below is red/green/blue/orange/brown
       -        // The number of colors defined here must correspond to the maximum number of players allowed for the gams
       -        $gameinfos = self::getGameinfos();
       -        $default_colors = $gameinfos['player_colors'];
       -        $default_animals = $gameinfos['player_animals'];
       - 
       -        // Create players
       -        // Note: if you added some extra field on "player" table in the database (dbmodel.sql), you can initialize it there.
       -        $sql = "INSERT INTO player (player_id, player_color, player_canal, player_name, player_avatar) VALUES ";
       -        $values = array();
       -        foreach( $players as $player_id => $player )
       -        {
       -            $color = array_shift( $default_colors );
       -            $values[] = "('".$player_id."','$color','".$player['player_canal']."','".addslashes( $player['player_name'] )."','".addslashes( $player['player_avatar'] )."')";
       -        }
       -        $sql .= implode( $values, ',' );
       -        self::DbQuery( $sql );
       -        self::reattributeColorsBasedOnPreferences( $players, $gameinfos['player_colors'] );
       -        self::reloadPlayersBasicInfos();
       -        
       -        /************ Start the game initialization *****/
       -
       -        // Init global values with their initial values
       -        //self::setGameStateInitialValue( 'my_first_global_variable', 0 );
       -        
       -        // Init game statistics
       -        // (note: statistics used in this file must be defined in your stats.inc.php file)
       -        //self::initStat( 'table', 'table_teststat1', 0 );    // Init a table statistics
       -        //self::initStat( 'player', 'player_teststat1', 0 );  // Init a player statistics (for all players)
       -
       -        // TODO: setup the initial game situation here
       -        $sql = "INSERT INTO playerboard (id, animal) VALUES";
       -        $values = array();
       -
       -        foreach( $players as $player_id => $player ) {
       -                $animal = array_shift($default_animals);
       -                $values[] = "( $player_id , '$animal' )";
       +                return "hadarawgs";
       +        }
       +
       +        /*
       +                setupNewGame:
       +
       +                This method is called only once, when a new game is launched.
       +                In this method, you must setup the game according to the game rules, so that
       +                the game is ready to be played.
       +        */
       +        protected function setupNewGame( $players, $options = array() )
       +        {
       +                // Set the colors of the players with HTML color code
       +                // The default below is red/green/blue/orange/brown
       +                // The number of colors defined here must correspond to the maximum number of players allowed for the gams
       +                $gameinfos = self::getGameinfos();
       +                $default_colors = $gameinfos['player_colors'];
       +                $default_animals = $gameinfos['player_animals'];
       +
       +                // Create players
       +                // Note: if you added some extra field on "player" table in the database (dbmodel.sql), you can initialize it there.
       +                $sql = "INSERT INTO player (
       +                        player_id,
       +                        player_color,
       +                        player_canal,
       +                        player_name,
       +                        player_avatar) VALUES ";
       +                $values = array();
       +                foreach( $players as $player_id => $player ) {
       +                        $color = array_shift( $default_colors );
       +                        $values[] = "('".$player_id."','$color','".$player['player_canal']."','".addslashes( $player['player_name'] )."','".addslashes( $player['player_avatar'] )."')";
       +                }
       +                $sql .= implode( $values, ',' );
       +                self::DbQuery( $sql );
       +                self::reattributeColorsBasedOnPreferences( $players, $gameinfos['player_colors'] );
       +                self::reloadPlayersBasicInfos();
       +
       +                /************ Start the game initialization *****/
       +
       +                // Init global values with their initial values
       +                //self::setGameStateInitialValue( 'my_first_global_variable', 0 );
       +
       +                // Init game statistics
       +                // (note: statistics used in this file must be defined in your stats.inc.php file)
       +                //self::initStat( 'table', 'table_teststat1', 0 );    // Init a table statistics
       +                //self::initStat( 'player', 'player_teststat1', 0 );  // Init a player statistics (for all players)
       +
       +                // TODO: setup the initial game situation here
       +                $sql = "INSERT INTO playerboard (id, animal) VALUES";
       +                $values = array();
       +
       +                foreach( $players as $player_id => $player ) {
       +                        $animal = array_shift($default_animals);
       +                        $values[] = "('$player_id', '$animal')";
       +                }
       +
       +                $sql .= implode( $values, ',' );
       +                self::DbQuery( $sql );
       +
       +                // Activate first player (which is in general a good idea :) )
       +                $this->activeNextPlayer();
       +
       +                /************ End of the game initialization *****/
                }
        
       -        $sql .= implode( $values, ',' );
       -        self::DbQuery( $sql );
       -
       -        // Activate first player (which is in general a good idea :) )
       -        $this->activeNextPlayer();
       -
       -        /************ End of the game initialization *****/
       -    }
       -
       -    /*
       -        getAllDatas: 
       -        
       -        Gather all informations about current game situation (visible by the current player).
       -        
       -        The method is called each time the game interface is displayed to a player, ie:
       -        _ when the game starts
       -        _ when a player refreshes the game page (F5)
       -    */
       -    protected function getAllDatas()
       -    {
       -        $result = array();
       -    
       -        $current_player_id = self::getCurrentPlayerId();    // !! We must only return informations visible by this player !!
       -    
       -        // Get information about players
       -        // Note: you can retrieve some extra field you added for "player" table in "dbmodel.sql" if you need it.
       -        $sql = "SELECT player_id id, player_score score FROM player ";
       -        $result['players'] = self::getCollectionFromDb( $sql );
       -
       -        // TODO: Gather all information about current game situation (visible by player $current_player_id).
       -        $sql = "SELECT * FROM playerboard";
       -        $result['boards'] = self::getCollectionFromDb( $sql );
       -  
       -        return $result;
       -    }
       -
       -    /*
       -        getGameProgression:
       -        
       -        Compute and return the current game progression.
       -        The number returned must be an integer beween 0 (=the game just started) and
       -        100 (= the game is finished or almost finished).
       -    
       -        This method is called each time we are in a game state with the "updateGameProgression" property set to true 
       -        (see states.inc.php)
       -    */
       -    function getGameProgression()
       -    {
       -        // TODO: compute and return the game progression
       -
       -        return 0;
       -    }
       +        /*
       +                getAllDatas:
       +
       +                Gather all informations about current game situation (visible by the current player).
       +
       +                The method is called each time the game interface is displayed to a player, ie:
       +                _ when the game starts
       +                _ when a player refreshes the game page (F5)
       +        */
       +        protected function getAllDatas()
       +        {
       +                $result = array();
       +
       +                $current_player_id = self::getCurrentPlayerId();    // !! We must only return informations visible by this player !!
       +
       +                // Get information about players
       +                // Note: you can retrieve some extra field you added for "player" table in "dbmodel.sql" if you need it.
       +                $sql = "SELECT player_id id, player_score score FROM player ";
       +                $result['players'] = self::getCollectionFromDb( $sql );
       +
       +                // TODO: Gather all information about current game situation (visible by player $current_player_id).
       +                $result['boards'] = self::getCollectionFromDb('SELECT * FROM playerboard');
       +
       +                return $result;
       +        }
       +
       +        /*
       +                getGameProgression:
       +
       +                Compute and return the current game progression.
       +                The number returned must be an integer beween 0 (=the game just started) and
       +                100 (= the game is finished or almost finished).
       +
       +                This method is called each time we are in a game state with the "updateGameProgression" property set to true
       +                (see states.inc.php)
       +        */
       +        function getGameProgression()
       +        {
       +                // TODO: compute and return the game progression
       +
       +                return 0;
       +        }
        
        
        //////////////////////////////////////////////////////////////////////////////
        //////////// Utility functions
       -////////////    
       +////////////
        
       -    /*
       -        In this space, you can put any utility methods useful for your game logic
       -    */
       +        /*
       +                In this space, you can put any utility methods useful for your game logic
       +        */
        
                function getPlayerBoard($player_id) {
                        $sql = "SELECT id, animal, income, income_max FROM playerboard where id = $player_id";
       t@@ -166,152 +168,152 @@ class hadarawgs extends Table
        
        //////////////////////////////////////////////////////////////////////////////
        //////////// Player actions
       -//////////// 
       -
       -    /*
       -        Each time a player is doing some game action, one of the methods below is called.
       -        (note: each method below must match an input method in hadarawgs.action.php)
       -    */
       -
       -    /*
       -    
       -    Example:
       -
       -    function playCard( $card_id )
       -    {
       -        // Check that this is the player's turn and that it is a "possible action" at this game state (see states.inc.php)
       -        self::checkAction( 'playCard' ); 
       -        
       -        $player_id = self::getActivePlayerId();
       -        
       -        // Add your game logic to play a card there 
       -        ...
       -        
       -        // Notify all players about the card played
       -        self::notifyAllPlayers( "cardPlayed", clienttranslate( '${player_name} plays ${card_name}' ), array(
       -            'player_id' => $player_id,
       -            'player_name' => self::getActivePlayerName(),
       -            'card_name' => $card_name,
       -            'card_id' => $card_id
       -        ) );
       -          
       -    }
       -    
       -    */
       -
       -    
       +////////////
       +
       +        /*
       +                Each time a player is doing some game action, one of the methods below is called.
       +                (note: each method below must match an input method in hadarawgs.action.php)
       +        */
       +
       +        /*
       +
       +        Example:
       +
       +        function playCard( $card_id )
       +        {
       +                // Check that this is the player's turn and that it is a "possible action" at this game state (see states.inc.php)
       +                self::checkAction( 'playCard' );
       +
       +                $player_id = self::getActivePlayerId();
       +
       +                // Add your game logic to play a card there
       +                ...
       +
       +                // Notify all players about the card played
       +                self::notifyAllPlayers( "cardPlayed", clienttranslate( '${player_name} plays ${card_name}' ), array(
       +                        'player_id' => $player_id,
       +                        'player_name' => self::getActivePlayerName(),
       +                        'card_name' => $card_name,
       +                        'card_id' => $card_id
       +                ) );
       +
       +        }
       +
       +        */
       +
       +
        //////////////////////////////////////////////////////////////////////////////
        //////////// Game state arguments
        ////////////
        
       -    /*
       -        Here, you can create methods defined as "game state arguments" (see "args" property in states.inc.php).
       -        These methods function is to return some additional information that is specific to the current
       -        game state.
       -    */
       -
       -    /*
       -    
       -    Example for game state "MyGameState":
       -    
       -    function argMyGameState()
       -    {
       -        // Get some values from the current game situation in database...
       -    
       -        // return values:
       -        return array(
       -            'variable1' => $value1,
       -            'variable2' => $value2,
       -            ...
       -        );
       -    }    
       -    */
       +        /*
       +                Here, you can create methods defined as "game state arguments" (see "args" property in states.inc.php).
       +                These methods function is to return some additional information that is specific to the current
       +                game state.
       +        */
       +
       +        /*
       +
       +        Example for game state "MyGameState":
       +
       +        function argMyGameState()
       +        {
       +                // Get some values from the current game situation in database...
       +
       +                // return values:
       +                return array(
       +                        'variable1' => $value1,
       +                        'variable2' => $value2,
       +                        ...
       +                );
       +        }
       +        */
        
        //////////////////////////////////////////////////////////////////////////////
        //////////// Game state actions
        ////////////
        
       -    /*
       -        Here, you can create methods defined as "game state actions" (see "action" property in states.inc.php).
       -        The action method of state X is called everytime the current game state is set to X.
       -    */
       -    
       -    /*
       -    
       -    Example for game state "MyGameState":
       -
       -    function stMyGameState()
       -    {
       -        // Do some stuff ...
       -        
       -        // (very often) go to another gamestate
       -        $this->gamestate->nextState( 'some_gamestate_transition' );
       -    }    
       -    */
       +        /*
       +                Here, you can create methods defined as "game state actions" (see "action" property in states.inc.php).
       +                The action method of state X is called everytime the current game state is set to X.
       +        */
       +
       +        /*
       +
       +        Example for game state "MyGameState":
       +
       +        function stMyGameState()
       +        {
       +                // Do some stuff ...
       +
       +                // (very often) go to another gamestate
       +                $this->gamestate->nextState( 'some_gamestate_transition' );
       +        }
       +        */
        
        //////////////////////////////////////////////////////////////////////////////
        //////////// Zombie
        ////////////
        
       -    /*
       -        zombieTurn:
       -        
       -        This method is called each time it is the turn of a player who has quit the game (= "zombie" player).
       -        You can do whatever you want in order to make sure the turn of this player ends appropriately
       -        (ex: pass).
       -        
       -        Important: your zombie code will be called when the player leaves the game. This action is triggered
       -        from the main site and propagated to the gameserver from a server, not from a browser.
       -        As a consequence, there is no current player associated to this action. In your zombieTurn function,
       -        you must _never_ use getCurrentPlayerId() or getCurrentPlayerName(), otherwise it will fail with a "Not logged" error message. 
       -    */
       -
       -    function zombieTurn( $state, $active_player )
       -    {
       -            $statename = $state['name'];
       -            
       -        if ($state['type'] === "activeplayer") {
       -            switch ($statename) {
       -                default:
       -                    $this->gamestate->nextState( "zombiePass" );
       -                        break;
       -            }
       -
       -            return;
       -        }
       -
       -        if ($state['type'] === "multipleactiveplayer") {
       -            // Make sure player is in a non blocking status for role turn
       -            $this->gamestate->setPlayerNonMultiactive( $active_player, '' );
       -            
       -            return;
       -        }
       -
       -        throw new feException( "Zombie mode not supported at this game state: ".$statename );
       -    }
       -    
       +        /*
       +                zombieTurn:
       +
       +                This method is called each time it is the turn of a player who has quit the game (= "zombie" player).
       +                You can do whatever you want in order to make sure the turn of this player ends appropriately
       +                (ex: pass).
       +
       +                Important: your zombie code will be called when the player leaves the game. This action is triggered
       +                from the main site and propagated to the gameserver from a server, not from a browser.
       +                As a consequence, there is no current player associated to this action. In your zombieTurn function,
       +                you must _never_ use getCurrentPlayerId() or getCurrentPlayerName(), otherwise it will fail with a "Not logged" error message.
       +        */
       +
       +        function zombieTurn( $state, $active_player )
       +        {
       +                $statename = $state['name'];
       +
       +                if ($state['type'] === "activeplayer") {
       +                        switch ($statename) {
       +                                default:
       +                                        $this->gamestate->nextState( "zombiePass" );
       +                                        break;
       +                        }
       +
       +                        return;
       +                }
       +
       +                if ($state['type'] === "multipleactiveplayer") {
       +                        // Make sure player is in a non blocking status for role turn
       +                        $this->gamestate->setPlayerNonMultiactive( $active_player, '' );
       +
       +                        return;
       +                }
       +
       +                throw new feException( "Zombie mode not supported at this game state: ".$statename );
       +        }
       +
        ///////////////////////////////////////////////////////////////////////////////////:
        ////////// DB upgrade
        //////////
        
       -    /*
       -        upgradeTableDb:
       -        
       -        You don't have to care about this until your game has been published on BGA.
       -        Once your game is on BGA, this method is called everytime the system detects a game running with your old
       -        Database scheme.
       -        In this case, if you change your Database scheme, you just have to apply the needed changes in order to
       -        update the game database and allow the game to continue to run with your new version.
       -    
       -    */
       -    
       -    function upgradeTableDb( $from_version )
       -    {
       -        // $from_version is the current version of this game database, in numerical form.
       -        // For example, if the game was running with a release of your game named "140430-1345",
       -        // $from_version is equal to 1404301345
       -        
       -        // Example:
       +        /*
       +                upgradeTableDb:
       +
       +                You don't have to care about this until your game has been published on BGA.
       +                Once your game is on BGA, this method is called everytime the system detects a game running with your old
       +                Database scheme.
       +                In this case, if you change your Database scheme, you just have to apply the needed changes in order to
       +                update the game database and allow the game to continue to run with your new version.
       +
       +        */
       +
       +        function upgradeTableDb( $from_version )
       +        {
       +                // $from_version is the current version of this game database, in numerical form.
       +                // For example, if the game was running with a release of your game named "140430-1345",
       +                // $from_version is equal to 1404301345
       +
       +                // Example:
        //        if( $from_version <= 1404301345 )
        //        {
        //            // ! important ! Use DBPREFIX_<table_name> for all tables
       t@@ -331,5 +333,5 @@ class hadarawgs extends Table
        //
        
        
       -    }    
       +        }
        }
 (DIR) diff --git a/hadarawgs.js b/hadarawgs.js
       t@@ -10,253 +10,246 @@
         * hadarawgs.js
         *
         * hadarawgs user interface script
       - * 
       + *
         * In this file, you are describing the logic of your user interface, in Javascript language.
         *
         */
        
        define([
       -    "dojo","dojo/_base/declare",
       -    "ebg/core/gamegui",
       -    "ebg/counter"
       +        "dojo","dojo/_base/declare",
       +        "ebg/core/gamegui",
       +        "ebg/counter"
        ],
       +
        function (dojo, declare) {
       -    return declare("bgagame.hadarawgs", ebg.core.gamegui, {
       -        constructor: function(){
       -            console.log('hadarawgs constructor');
       -              
       -            // Here, you can init the global variables of your user interface
       -            // Example:
       -            // this.myGlobalValue = 0;
       -
       -        },
       -        
       -        /*
       -            setup:
       -            
       -            This method must set up the game user interface according to current game situation specified
       -            in parameters.
       -            
       -            The method is called each time the game interface is displayed to a player, ie:
       -            _ when the game starts
       -            _ when a player refreshes the game page (F5)
       -            
       -            "gamedatas" argument contains all datas retrieved by your "getAllDatas" PHP method.
       -        */
       -        
       -        setup: function( gamedatas )
       -        {
       -            console.log( "Starting game setup" );
       -            
       -            // Setting up player boards
       -            for( var player_id in gamedatas.players )
       -            {
       -                var el;
       -                var player = gamedatas.players[player_id];
       -                         
       -                // TODO: Setting up players boards if needed
       -                el = document.getElementById('income_p' + player_id);
       -                el.innerHTML = gamedatas.boards[player_id]['income'];
       -                el = document.getElementById('income_max_p' + player_id);
       -                el.innerHTML = gamedatas.boards[player_id]['income_max'];
       -            }
       -            
       -            // TODO: Set up your game interface here, according to "gamedatas"
       -            
       - 
       -            // Setup game notifications to handle (see "setupNotifications" method below)
       -            this.setupNotifications();
       -
       -            console.log( "Ending game setup" );
       -        },
       -       
       -
       -        ///////////////////////////////////////////////////
       -        //// Game & client states
       -        
       -        // onEnteringState: this method is called each time we are entering into a new game state.
       -        //                  You can use this method to perform some user interface changes at this moment.
       -        //
       -        onEnteringState: function( stateName, args )
       -        {
       -            console.log( 'Entering state: '+stateName );
       -            
       -            switch( stateName )
       -            {
       -            
       -            /* Example:
       -            
       -            case 'myGameState':
       -            
       -                // Show some HTML block at this game state
       -                dojo.style( 'my_html_block_id', 'display', 'block' );
       -                
       -                break;
       -           */
       -           
       -           
       -            case 'dummmy':
       -                break;
       -            }
       -        },
       -
       -        // onLeavingState: this method is called each time we are leaving a game state.
       -        //                 You can use this method to perform some user interface changes at this moment.
       -        //
       -        onLeavingState: function( stateName )
       -        {
       -            console.log( 'Leaving state: '+stateName );
       -            
       -            switch( stateName )
       -            {
       -            
       -            /* Example:
       -            
       -            case 'myGameState':
       -            
       -                // Hide the HTML block we are displaying only during this game state
       -                dojo.style( 'my_html_block_id', 'display', 'none' );
       -                
       -                break;
       -           */
       -           
       -           
       -            case 'dummmy':
       -                break;
       -            }               
       -        }, 
       -
       -        // onUpdateActionButtons: in this method you can manage "action buttons" that are displayed in the
       -        //                        action status bar (ie: the HTML links in the status bar).
       -        //        
       -        onUpdateActionButtons: function( stateName, args )
       -        {
       -            console.log( 'onUpdateActionButtons: '+stateName );
       -                      
       -            if( this.isCurrentPlayerActive() )
       -            {            
       -                switch( stateName )
       -                {
       -/*               
       -                 Example:
       - 
       -                 case 'myGameState':
       -                    
       -                    // Add 3 action buttons in the action status bar:
       -                    
       -                    this.addActionButton( 'button_1_id', _('Button 1 label'), 'onMyMethodToCall1' ); 
       -                    this.addActionButton( 'button_2_id', _('Button 2 label'), 'onMyMethodToCall2' ); 
       -                    this.addActionButton( 'button_3_id', _('Button 3 label'), 'onMyMethodToCall3' ); 
       -                    break;
       +        return declare("bgagame.hadarawgs", ebg.core.gamegui, {
       +                constructor: function() {
       +                        console.log('hadarawgs constructor');
       +
       +                        // Here, you can init the global variables of your user interface
       +                        // Example:
       +                        // this.myGlobalValue = 0;
       +
       +                },
       +
       +                /*
       +                 * setup:
       +                 *
       +                 * This method must set up the game user interface according to current game situation specified
       +                 * in parameters.
       +                 *
       +                 * The method is called each time the game interface is displayed to a player, ie:
       +                 * _ when the game starts
       +                 * _ when a player refreshes the game page (F5)
       +                 *
       +                 * "gamedatas" argument contains all datas retrieved by your "getAllDatas" PHP method.
       +                */
       +
       +                setup: function( gamedatas ) {
       +                        console.log( "Starting game setup" );
       +
       +                        // Setting up player boards
       +                        for (var player_id in gamedatas.players) {
       +                                var player = gamedatas.players[player_id];
       +                                var board  = gamedatas.boards[player_id];
       +                        }
       +
       +                        // TODO: Set up your game interface here, according to "gamedatas"
       +
       +
       +                        // Setup game notifications to handle (see "setupNotifications" method below)
       +                        this.setupNotifications();
       +
       +                        console.log( "Ending game setup" );
       +                },
       +
       +
       +                ///////////////////////////////////////////////////
       +                //// Game & client states
       +
       +                // onEnteringState: this method is called each time we are entering into a new game state.
       +                //                  You can use this method to perform some user interface changes at this moment.
       +                //
       +                onEnteringState: function( stateName, args )
       +                {
       +                        console.log( 'Entering state: '+stateName );
       +
       +                        switch( stateName )
       +                        {
       +
       +                        /* Example:
       +
       +                        case 'myGameState':
       +
       +                                // Show some HTML block at this game state
       +                                dojo.style( 'my_html_block_id', 'display', 'block' );
       +
       +                                break;
       +                   */
       +
       +
       +                        case 'dummmy':
       +                                break;
       +                        }
       +                },
       +
       +                // onLeavingState: this method is called each time we are leaving a game state.
       +                //                 You can use this method to perform some user interface changes at this moment.
       +                //
       +                onLeavingState: function( stateName )
       +                {
       +                        console.log( 'Leaving state: '+stateName );
       +
       +                        switch( stateName )
       +                        {
       +
       +                        /* Example:
       +
       +                        case 'myGameState':
       +
       +                                // Hide the HTML block we are displaying only during this game state
       +                                dojo.style( 'my_html_block_id', 'display', 'none' );
       +
       +                                break;
       +                   */
       +
       +
       +                        case 'dummmy':
       +                                break;
       +                        }
       +                },
       +
       +                // onUpdateActionButtons: in this method you can manage "action buttons" that are displayed in the
       +                //                        action status bar (ie: the HTML links in the status bar).
       +                //
       +                onUpdateActionButtons: function( stateName, args )
       +                {
       +                        console.log( 'onUpdateActionButtons: '+stateName );
       +
       +                        if( this.isCurrentPlayerActive() )
       +                        {
       +                                switch( stateName )
       +                                {
       +/*
       +                                Example:
       +
       +                                case 'myGameState':
       +
       +                                   // Add 3 action buttons in the action status bar:
       +
       +                                this.addActionButton( 'button_1_id', _('Button 1 label'), 'onMyMethodToCall1' );
       +                                this.addActionButton( 'button_2_id', _('Button 2 label'), 'onMyMethodToCall2' );
       +                                this.addActionButton( 'button_3_id', _('Button 3 label'), 'onMyMethodToCall3' );
       +                                break;
        */
       -                }
       -            }
       -        },        
       -
       -        ///////////////////////////////////////////////////
       -        //// Utility methods
       -        
       -        /*
       -        
       -            Here, you can defines some utility methods that you can use everywhere in your javascript
       -            script.
       -        
       -        */
       -
       -
       -        ///////////////////////////////////////////////////
       -        //// Player's action
       -        
       -        /*
       -        
       -            Here, you are defining methods to handle player's action (ex: results of mouse click on 
       -            game objects).
       -            
       -            Most of the time, these methods:
       -            _ check the action is possible at this game state.
       -            _ make a call to the game server
       -        
       -        */
       -        
       -        /* Example:
       -        
       -        onMyMethodToCall1: function( evt )
       -        {
       -            console.log( 'onMyMethodToCall1' );
       -            
       -            // Preventing default browser reaction
       -            dojo.stopEvent( evt );
       -
       -            // Check that this action is possible (see "possibleactions" in states.inc.php)
       -            if( ! this.checkAction( 'myAction' ) )
       -            {   return; }
       -
       -            this.ajaxcall( "/hadarawgs/hadarawgs/myAction.html", { 
       -                                                                    lock: true, 
       -                                                                    myArgument1: arg1, 
       -                                                                    myArgument2: arg2,
       -                                                                    ...
       -                                                                 }, 
       -                         this, function( result ) {
       -                            
       -                            // What to do after the server call if it succeeded
       -                            // (most of the time: nothing)
       -                            
       -                         }, function( is_error) {
       -
       -                            // What to do after the server call in anyway (success or failure)
       -                            // (most of the time: nothing)
       -
       -                         } );        
       -        },        
       -        
       -        */
       -
       -        
       -        ///////////////////////////////////////////////////
       -        //// Reaction to cometD notifications
       -
       -        /*
       -            setupNotifications:
       -            
       -            In this method, you associate each of your game notifications with your local method to handle it.
       -            
       -            Note: game notification names correspond to "notifyAllPlayers" and "notifyPlayer" calls in
       -                  your hadarawgs.game.php file.
       -        
       -        */
       -        setupNotifications: function()
       -        {
       -            console.log( 'notifications subscriptions setup' );
       -            
       -            // TODO: here, associate your game notifications with local methods
       -            
       -            // Example 1: standard notification handling
       -            // dojo.subscribe( 'cardPlayed', this, "notif_cardPlayed" );
       -            
       -            // Example 2: standard notification handling + tell the user interface to wait
       -            //            during 3 seconds after calling the method in order to let the players
       -            //            see what is happening in the game.
       -            // dojo.subscribe( 'cardPlayed', this, "notif_cardPlayed" );
       -            // this.notifqueue.setSynchronous( 'cardPlayed', 3000 );
       -            // 
       -        },  
       -        
       -        // TODO: from this point and below, you can write your game notifications handling methods
       -        
       -        /*
       -        Example:
       -        
       -        notif_cardPlayed: function( notif )
       -        {
       -            console.log( 'notif_cardPlayed' );
       -            console.log( notif );
       -            
       -            // Note: notif.args contains the arguments specified during you "notifyAllPlayers" / "notifyPlayer" PHP call
       -            
       -            // TODO: play the card in the user interface.
       -        },    
       -        
       -        */
       -   });             
       +                                }
       +                        }
       +                },
       +
       +                ///////////////////////////////////////////////////
       +                //// Utility methods
       +
       +                /*
       +
       +                        Here, you can defines some utility methods that you can use everywhere in your javascript
       +                        script.
       +
       +                */
       +
       +
       +                ///////////////////////////////////////////////////
       +                //// Player's action
       +
       +                /*
       +
       +                        Here, you are defining methods to handle player's action (ex: results of mouse click on
       +                        game objects).
       +
       +                        Most of the time, these methods:
       +                        _ check the action is possible at this game state.
       +                        _ make a call to the game server
       +
       +                */
       +
       +                /* Example:
       +
       +                onMyMethodToCall1: function( evt )
       +                {
       +                        console.log( 'onMyMethodToCall1' );
       +
       +                        // Preventing default browser reaction
       +                        dojo.stopEvent( evt );
       +
       +                        // Check that this action is possible (see "possibleactions" in states.inc.php)
       +                        if( ! this.checkAction( 'myAction' ) )
       +                        {   return; }
       +
       +                        this.ajaxcall( "/hadarawgs/hadarawgs/myAction.html", {
       +                                                                                    lock: true,
       +                                                                                    myArgument1: arg1,
       +                                                                                    myArgument2: arg2,
       +                                                                                    ...
       +                                                                                 },
       +                                         this, function( result ) {
       +
       +                                            // What to do after the server call if it succeeded
       +                                            // (most of the time: nothing)
       +
       +                                         }, function( is_error) {
       +
       +                                            // What to do after the server call in anyway (success or failure)
       +                                            // (most of the time: nothing)
       +
       +                                         } );
       +                },
       +
       +                */
       +
       +
       +                ///////////////////////////////////////////////////
       +                //// Reaction to cometD notifications
       +
       +                /*
       +                        setupNotifications:
       +
       +                        In this method, you associate each of your game notifications with your local method to handle it.
       +
       +                        Note: game notification names correspond to "notifyAllPlayers" and "notifyPlayer" calls in
       +                                  your hadarawgs.game.php file.
       +
       +                */
       +                setupNotifications: function()
       +                {
       +                        console.log( 'notifications subscriptions setup' );
       +
       +                        // TODO: here, associate your game notifications with local methods
       +
       +                        // Example 1: standard notification handling
       +                        // dojo.subscribe( 'cardPlayed', this, "notif_cardPlayed" );
       +
       +                        // Example 2: standard notification handling + tell the user interface to wait
       +                        //            during 3 seconds after calling the method in order to let the players
       +                        //            see what is happening in the game.
       +                        // dojo.subscribe( 'cardPlayed', this, "notif_cardPlayed" );
       +                        // this.notifqueue.setSynchronous( 'cardPlayed', 3000 );
       +                        //
       +                },
       +
       +                // TODO: from this point and below, you can write your game notifications handling methods
       +
       +                /*
       +                Example:
       +
       +                notif_cardPlayed: function( notif )
       +                {
       +                        console.log( 'notif_cardPlayed' );
       +                        console.log( notif );
       +
       +                        // Note: notif.args contains the arguments specified during you "notifyAllPlayers" / "notifyPlayer" PHP call
       +
       +                        // TODO: play the card in the user interface.
       +                },
       +
       +                */
       +   });
        });
 (DIR) diff --git a/hadarawgs.view.php b/hadarawgs.view.php
       t@@ -23,49 +23,40 @@
         * Note: if the HTML of your game interface is always the same, you don't have to place anything here.
         *
         */
       -  
       -  require_once( APP_BASE_PATH."view/common/game.view.php" );
       -  
       -  class view_hadarawgs_hadarawgs extends game_view
       -  {
       -    function getGameName() {
       -        return "hadarawgs";
       -    }    
       -          function build_page( $viewArgs )
       -          {                
       -              // Get players & players number
       -        $players = $this->game->loadPlayersBasicInfos();
       -        $players_nbr = count( $players );
        
       -        /*********** Place your code below:  ************/
       -        /*
       -        
       -        // Examples: set the value of some element defined in your tpl file like this: {MY_VARIABLE_ELEMENT}
       +require_once( APP_BASE_PATH."view/common/game.view.php" );
        
       -        // Display a specific number / string
       -        $this->tpl['MY_VARIABLE_ELEMENT'] = $number_to_display;
       +class view_hadarawgs_hadarawgs extends game_view
       +{
       +        function getGameName() {
       +                return "hadarawgs";
       +        }
       +        function build_page( $viewArgs )
       +        {
       +                // Get players & players number
       +                $players = $this->game->loadPlayersBasicInfos();
       +                $players_nbr = count( $players );
        
       -        // Display a string to be translated in all languages: 
       -        $this->tpl['MY_VARIABLE_ELEMENT'] = self::_("A string to be translated");
       +                /*********** Place your code below:  ************/
       +                /*
       +                 * Examples: set the value of some element defined in your tpl file like this: {MY_VARIABLE_ELEMENT}
       +                 $this->tpl['MY_VARIABLE_ELEMENT'] = $number_to_display;
       +                 $this->tpl['MY_VARIABLE_ELEMENT'] = self::_("A string to be translated");
       +                 $this->tpl['MY_VARIABLE_ELEMENT'] = self::raw( $some_html_code );
       +                 */
        
       -        // Display some HTML content of your own:
       -        $this->tpl['MY_VARIABLE_ELEMENT'] = self::raw( $some_html_code );
       -        
       -        */
       -        
       -        $this->page->begin_block( "hadarawgs_hadarawgs", "player" );
       -        foreach( $players as $player_id=>$player ) {
       -            $board = $this->game->getPlayerBoard($player_id);
       -            $this->page->insert_block( "player", array( 
       -                                                    "PLAYER_ID" => $player_id,
       -                                                    "PLAYER_NAME" => $player['player_name'],
       -                                                    "PLAYER_COLOR" => $player['player_color'],
       -                                                    "PLAYER_ANIMAL" => $board[$player_id]['animal'],
       -                                                     ) );
       -        }
       -
       -        /*********** Do not change anything below this line  ************/
       -          }
       -  }
       -  
       +                $this->page->begin_block( "hadarawgs_hadarawgs", "player" );
       +                foreach( $players as $player_id=>$player ) {
       +                        $board = $this->game->getPlayerBoard($player_id);
       +                        $this->page->insert_block( "player", array(
       +                                "PLAYER_ID" => $player_id,
       +                                "PLAYER_NAME" => $player['player_name'],
       +                                "PLAYER_COLOR" => $player['player_color'],
       +                                "PLAYER_ANIMAL" => $board[$player_id]['animal'],
       +                                )
       +                        );
       +                }
        
       +                /*********** Do not change anything below this line  ************/
       +        }
       +}
 (DIR) diff --git a/material.inc.php b/material.inc.php
       t@@ -3,7 +3,7 @@
         *------
         * BGA framework: © Gregory Isabelli <gisabelli@boardgamearena.com> & Emmanuel Colin <ecolin@boardgamearena.com>
         * hadarawgs implementation : © Willy Goiffon <dev@z3bra.org>
       - * 
       + *
         * This code has been produced on the BGA studio platform for use on http://boardgamearena.com.
         * See http://en.boardgamearena.com/#!doc/Studio for more information.
         * -----
       t@@ -13,7 +13,7 @@
         * hadarawgs game material description
         *
         * Here, you can describe the material of your game with PHP variables.
       - *   
       + *
         * This file is loaded in your game logic class constructor, ie these variables
         * are available everywhere in your game logic code.
         *
       t@@ -23,11 +23,10 @@
        /*
        
        Example:
       -
        $this->card_types = array(
       -    1 => array( "card_name" => ...,
       -                ...
       -              )
       +        1 => array( "card_name" => ...,
       +                                ...
       +                          )
        );
        
        */
 (DIR) diff --git a/states.inc.php b/states.inc.php
       t@@ -7,7 +7,7 @@
         * This code has been produced on the BGA studio platform for use on http://boardgamearena.com.
         * See http://en.boardgamearena.com/#!doc/Studio for more information.
         * -----
       - * 
       + *
         * states.inc.php
         *
         * hadarawgs game states description
       t@@ -15,95 +15,95 @@
         */
        
        /*
       -   Game state machine is a tool used to facilitate game developpement by doing common stuff that can be set up
       -   in a very easy way from this configuration file.
       -
       -   Please check the BGA Studio presentation about game state to understand this, and associated documentation.
       -
       -   Summary:
       -
       -   States types:
       -   _ activeplayer: in this type of state, we expect some action from the active player.
       -   _ multipleactiveplayer: in this type of state, we expect some action from multiple players (the active players)
       -   _ game: this is an intermediary state where we don't expect any actions from players. Your game logic must decide what is the next game state.
       -   _ manager: special type for initial and final state
       -
       -   Arguments of game states:
       -   _ name: the name of the GameState, in order you can recognize it on your own code.
       -   _ description: the description of the current game state is always displayed in the action status bar on
       -                  the top of the game. Most of the time this is useless for game state with "game" type.
       -   _ descriptionmyturn: the description of the current game state when it's your turn.
       -   _ type: defines the type of game states (activeplayer / multipleactiveplayer / game / manager)
       -   _ action: name of the method to call when this game state become the current game state. Usually, the
       -             action method is prefixed by "st" (ex: "stMyGameStateName").
       -   _ possibleactions: array that specify possible player actions on this step. It allows you to use "checkAction"
       -                      method on both client side (Javacript: this.checkAction) and server side (PHP: self::checkAction).
       -   _ transitions: the transitions are the possible paths to go from a game state to another. You must name
       -                  transitions in order to use transition names in "nextState" PHP method, and use IDs to
       -                  specify the next game state for each transition.
       -   _ args: name of the method to call to retrieve arguments for this gamestate. Arguments are sent to the
       -           client side to be used on "onEnteringState" or to set arguments in the gamestate description.
       -   _ updateGameProgression: when specified, the game progression is updated (=> call to your getGameProgression
       -                            method).
       -*/
       + * Game state machine is a tool used to facilitate game developpement by doing common stuff that can be set up
       + * in a very easy way from this configuration file.
       + *
       + * Please check the BGA Studio presentation about game state to understand this, and associated documentation.
       + *
       + * Summary:
       + *
       + * States types:
       + * _ activeplayer: in this type of state, we expect some action from the active player.
       + * _ multipleactiveplayer: in this type of state, we expect some action from multiple players (the active players)
       + * _ game: this is an intermediary state where we don't expect any actions
       + *   from players. Your game logic must decide what is the next game state.
       + * _ manager: special type for initial and final state
       + *
       + * Arguments of game states:
       + * _ name: the name of the GameState, in order you can recognize it on your own code.
       + * _ description: the description of the current game state is always displayed in the action status bar on
       + *   the top of the game. Most of the time this is useless for game state with "game" type.
       + * _ descriptionmyturn: the description of the current game state when it's your turn.
       + * _ type: defines the type of game states (activeplayer / multipleactiveplayer / game / manager)
       + * _ action: name of the method to call when this game state become the current game state. Usually, the
       + *   action method is prefixed by "st" (ex: "stMyGameStateName").
       + * _ possibleactions: array that specify possible player actions on this step. It allows you to use "checkAction"
       + *   method on both client side (Javacript: this.checkAction) and server side (PHP: self::checkAction).
       + * _ transitions: the transitions are the possible paths to go from a game state to another. You must name
       + *   transitions in order to use transition names in "nextState" PHP method, and use IDs to
       + *   specify the next game state for each transition.
       + * _ args: name of the method to call to retrieve arguments for this gamestate. Arguments are sent to the
       + *   client side to be used on "onEnteringState" or to set arguments in the gamestate description.
       + * _ updateGameProgression: when specified, the game progression is updated (=> call to your getGameProgression method).
       + */
        
        //    !! It is not a good idea to modify this file when a game is running !!
        
       - 
       +
        $machinestates = array(
        
       -    // The initial state. Please do not modify.
       -    1 => array(
       -        "name" => "gameSetup",
       -        "description" => "",
       -        "type" => "manager",
       -        "action" => "stGameSetup",
       -        "transitions" => array( "" => 2 )
       -    ),
       -    
       -    // Note: ID=2 => your first state
       -
       -    2 => array(
       -                    "name" => "playerTurn",
       -                    "description" => clienttranslate('${actplayer} must play a card or pass'),
       -                    "descriptionmyturn" => clienttranslate('${you} must play a card or pass'),
       -                    "type" => "activeplayer",
       -                    "possibleactions" => array( "playCard", "pass" ),
       -                    "transitions" => array( "playCard" => 2, "pass" => 2 )
       -    ),
       -    
       +        // The initial state. Please do not modify.
       +        1 => array(
       +                "name" => "gameSetup",
       +                "description" => "",
       +                "type" => "manager",
       +                "action" => "stGameSetup",
       +                "transitions" => array( "" => 2 )
       +        ),
       +
       +        // Note: ID=2 => your first state
       +
       +        2 => array(
       +                "name" => "playerTurn",
       +                "description" => clienttranslate('${actplayer} must play a card or pass'),
       +                "descriptionmyturn" => clienttranslate('${you} must play a card or pass'),
       +                "type" => "activeplayer",
       +                "possibleactions" => array( "playCard", "pass" ),
       +                "transitions" => array( "playCard" => 2, "pass" => 2 )
       +        ),
       +
        /*
       -    Examples:
       -    
       -    2 => array(
       -        "name" => "nextPlayer",
       -        "description" => '',
       -        "type" => "game",
       -        "action" => "stNextPlayer",
       -        "updateGameProgression" => true,   
       -        "transitions" => array( "endGame" => 99, "nextPlayer" => 10 )
       -    ),
       -    
       -    10 => array(
       -        "name" => "playerTurn",
       -        "description" => clienttranslate('${actplayer} must play a card or pass'),
       -        "descriptionmyturn" => clienttranslate('${you} must play a card or pass'),
       -        "type" => "activeplayer",
       -        "possibleactions" => array( "playCard", "pass" ),
       -        "transitions" => array( "playCard" => 2, "pass" => 2 )
       -    ), 
       -
       -*/    
       -   
       -    // Final state.
       -    // Please do not modify (and do not overload action/args methods).
       -    99 => array(
       -        "name" => "gameEnd",
       -        "description" => clienttranslate("End of game"),
       -        "type" => "manager",
       -        "action" => "stGameEnd",
       -        "args" => "argGameEnd"
       -    )
       +        Examples:
       +
       +        2 => array(
       +                "name" => "nextPlayer",
       +                "description" => '',
       +                "type" => "game",
       +                "action" => "stNextPlayer",
       +                "updateGameProgression" => true,
       +                "transitions" => array( "endGame" => 99, "nextPlayer" => 10 )
       +        ),
       +
       +        10 => array(
       +                "name" => "playerTurn",
       +                "description" => clienttranslate('${actplayer} must play a card or pass'),
       +                "descriptionmyturn" => clienttranslate('${you} must play a card or pass'),
       +                "type" => "activeplayer",
       +                "possibleactions" => array( "playCard", "pass" ),
       +                "transitions" => array( "playCard" => 2, "pass" => 2 )
       +        ),
       +
       +*/
       +
       +        // Final state.
       +        // Please do not modify (and do not overload action/args methods).
       +        99 => array(
       +                "name" => "gameEnd",
       +                "description" => clienttranslate("End of game"),
       +                "type" => "manager",
       +                "action" => "stGameEnd",
       +                "args" => "argGameEnd"
       +        )
        
        );
        
 (DIR) diff --git a/stats.inc.php b/stats.inc.php
       t@@ -16,80 +16,76 @@
         */
        
        /*
       -    In this file, you are describing game statistics, that will be displayed at the end of the
       -    game.
       -    
       -    !! After modifying this file, you must use "Reload  statistics configuration" in BGA Studio backoffice
       -    ("Control Panel" / "Manage Game" / "Your Game")
       -    
       -    There are 2 types of statistics:
       -    _ table statistics, that are not associated to a specific player (ie: 1 value for each game).
       -    _ player statistics, that are associated to each players (ie: 1 value for each player in the game).
       -
       -    Statistics types can be "int" for integer, "float" for floating point values, and "bool" for boolean
       -    
       -    Once you defined your statistics there, you can start using "initStat", "setStat" and "incStat" method
       -    in your game logic, using statistics names defined below.
       -    
       -    !! It is not a good idea to modify this file when a game is running !!
       -
       -    If your game is already public on BGA, please read the following before any change:
       -    http://en.doc.boardgamearena.com/Post-release_phase#Changes_that_breaks_the_games_in_progress
       -    
       -    Notes:
       -    * Statistic index is the reference used in setStat/incStat/initStat PHP method
       -    * Statistic index must contains alphanumerical characters and no space. Example: 'turn_played'
       -    * Statistics IDs must be >=10
       -    * Two table statistics can't share the same ID, two player statistics can't share the same ID
       -    * A table statistic can have the same ID than a player statistics
       -    * Statistics ID is the reference used by BGA website. If you change the ID, you lost all historical statistic data. Do NOT re-use an ID of a deleted statistic
       -    * Statistic name is the English description of the statistic as shown to players
       -    
       +        In this file, you are describing game statistics, that will be displayed at the end of the
       +        game.
       +
       +        !! After modifying this file, you must use "Reload  statistics configuration" in BGA Studio backoffice
       +        ("Control Panel" / "Manage Game" / "Your Game")
       +
       +        There are 2 types of statistics:
       +        _ table statistics, that are not associated to a specific player (ie: 1 value for each game).
       +        _ player statistics, that are associated to each players (ie: 1 value for each player in the game).
       +
       +        Statistics types can be "int" for integer, "float" for floating point values, and "bool" for boolean
       +
       +        Once you defined your statistics there, you can start using "initStat", "setStat" and "incStat" method
       +        in your game logic, using statistics names defined below.
       +
       +        !! It is not a good idea to modify this file when a game is running !!
       +
       +        If your game is already public on BGA, please read the following before any change:
       +        http://en.doc.boardgamearena.com/Post-release_phase#Changes_that_breaks_the_games_in_progress
       +
       +        Notes:
       +        * Statistic index is the reference used in setStat/incStat/initStat PHP method
       +        * Statistic index must contains alphanumerical characters and no space. Example: 'turn_played'
       +        * Statistics IDs must be >=10
       +        * Two table statistics can't share the same ID, two player statistics can't share the same ID
       +        * A table statistic can have the same ID than a player statistics
       +        * Statistics ID is the reference used by BGA website. If you change the ID, you lost all historical statistic data. Do NOT re-use an ID of a deleted statistic
       +        * Statistic name is the English description of the statistic as shown to players
       +
        */
        
        $stats_type = array(
        
       -    // Statistics global to table
       -    "table" => array(
       +        // Statistics global to table
       +        "table" => array(
        
       -        "turns_number" => array("id"=> 10,
       -                    "name" => totranslate("Number of turns"),
       -                    "type" => "int" ),
       +                "turns_number" => array("id"=> 10,
       +                        "name" => totranslate("Number of turns"),
       +                        "type" => "int" ),
        
        /*
       -        Examples:
       -
       -
       -        "table_teststat1" => array(   "id"=> 10,
       -                                "name" => totranslate("table test stat 1"), 
       -                                "type" => "int" ),
       -                                
       -        "table_teststat2" => array(   "id"=> 11,
       -                                "name" => totranslate("table test stat 2"), 
       -                                "type" => "float" )
       -*/  
       -    ),
       -    
       -    // Statistics existing for each player
       -    "player" => array(
       -
       -        "turns_number" => array("id"=> 10,
       -                    "name" => totranslate("Number of turns"),
       -                    "type" => "int" ),
       -    
       +                Examples:
       +                "table_teststat1" => array(   "id"=> 10,
       +                        "name" => totranslate("table test stat 1"),
       +                        "type" => "int" ),
       +
       +                "table_teststat2" => array(   "id"=> 11,
       +                        "name" => totranslate("table test stat 2"),
       +                        "type" => "float" )
       +*/
       +        ),
       +
       +        // Statistics existing for each player
       +        "player" => array(
       +
       +                "turns_number" => array("id"=> 10,
       +                        "name" => totranslate("Number of turns"),
       +                        "type" => "int" ),
       +
        /*
       -        Examples:    
       -        
       -        
       -        "player_teststat1" => array(   "id"=> 10,
       -                                "name" => totranslate("player test stat 1"), 
       -                                "type" => "int" ),
       -                                
       -        "player_teststat2" => array(   "id"=> 11,
       -                                "name" => totranslate("player test stat 2"), 
       -                                "type" => "float" )
       -
       -*/    
       -    )
       +                Examples:
       +                "player_teststat1" => array(   "id"=> 10,
       +                        "name" => totranslate("player test stat 1"),
       +                        "type" => "int" ),
       +
       +                "player_teststat2" => array(   "id"=> 11,
       +                        "name" => totranslate("player test stat 2"),
       +                        "type" => "float" )
       +
       +*/
       +        )
        
        );
 (DIR) diff --git a/version.php b/version.php
       t@@ -1,3 +1,3 @@
       -<?php 
       +<?php
        // Please do not modify this file.
        $game_version_hadarawgs ="999999-9999";