Skip to content

Commit

Permalink
db init and materials
Browse files Browse the repository at this point in the history
  • Loading branch information
jraymakers committed Jul 8, 2020
1 parent 246cf75 commit 3a49717
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
15 changes: 14 additions & 1 deletion heartsjephly.game.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function __construct( )

self::initGameStateLabels( array(
'roundType' => 10, // 0, 1, 2, 3 = pass left, pass right, pass opposite, no pass
'trickSuit' => 11, // 1, 2, 3, 4 = Spades, Hearts, Clubs, Diamonds
'trickSuit' => 11, // 0, 1, 2, 3, 4 = none, Spades, Hearts, Clubs, Diamonds
'heartsBroken' => 12, // 0 or 1 = false, true
// "my_first_global_variable" => 10,
// "my_second_global_variable" => 11,
Expand Down Expand Up @@ -87,13 +87,26 @@ protected function setupNewGame( $players, $options = array() )

// Init global values with their initial values
//self::setGameStateInitialValue( 'my_first_global_variable', 0 );

self::setGameStateInitialValue( 'roundType', 0 );
self::setGameStateInitialValue( 'trickSuit', 0 );
self::setGameStateInitialValue( 'heartsBroken', 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

$cards = array();
foreach ( $this->suits as $suit_id => $suit ) {
for ($rank = 2; $rank <= 14; $rank++) {
$cards[] = array( 'type' => $suit_id, 'type_arg' => $rank, 'nbr' => 1 );
}
}

$this->cards->createCards( $cards, 'deck' );


// Activate first player (which is in general a good idea :) )
Expand Down
35 changes: 33 additions & 2 deletions material.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,37 @@
*/

$this->suits = array(
1 => array(
'name' => clienttranslate('spade'),
'nametr' => self::_('spade'),
),
2 => array(
'name' => clienttranslate('heart'),
'nametr' => self::_('heart'),
),
3 => array(
'name' => clienttranslate('club'),
'nametr' => self::_('club'),
),
4 => array(
'name' => clienttranslate('diamond'),
'nametr' => self::_('diamond'),
),
);



$this->rank_labels = array(
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => '6',
7 => '7',
8 => '8',
9 => '9',
10 => '10',
11 => clienttranslate('J'),
12 => clienttranslate('Q'),
13 => clienttranslate('K'),
14 => clienttranslate('A'),
);

0 comments on commit 3a49717

Please sign in to comment.