tLoad player animal name for game view - 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 d6b70829cd336bbe542885ccf3ed79660ac4b2d4
(DIR) parent 510015dd1eec5be811558ca5cddb184a3a6ea907
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Sun, 1 Mar 2020 13:55:05 +0100
Load player animal name for game view
Diffstat:
M hadarawgs.css | 6 ++++++
M hadarawgs.game.php | 8 ++++++++
M hadarawgs.view.php | 2 ++
M hadarawgs_hadarawgs.tpl | 2 +-
4 files changed, 17 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/hadarawgs.css b/hadarawgs.css
t@@ -17,6 +17,12 @@
/********* You can start writing your CSS below this line: **********/
+.player-dragon::after { content: " - dragon"; }
+.player-lion::after { content: " - lion"; }
+.player-monkey::after { content: " - monkey"; }
+.player-pegasus::after { content: " - pegasus"; }
+.player-scarab::after { content: " - scarab"; }
+
.resources-container {
text-align: center;
font-weight: bold;
(DIR) diff --git a/hadarawgs.game.php b/hadarawgs.game.php
t@@ -127,6 +127,9 @@ class hadarawgs extends Table
$result['players'] = self::getCollectionFromDb( $sql );
// TODO: Gather all information about current game situation (visible by player $current_player_id).
+ foreach ($result['players'] as $player) {
+ $player['board'] = $this->getPlayerBoard($player['id']);
+ }
return $result;
}
t@@ -157,6 +160,11 @@ class hadarawgs extends Table
In this space, you can put any utility methods useful for your game logic
*/
+ function getPlayerBoard($player_id) {
+ $sql = "SELECT * FROM playerboard where id = $player_id";
+ return self::getCollectionFromDb($sql);
+ }
+
//////////////////////////////////////////////////////////////////////////////
//////////// Player actions
////////////
(DIR) diff --git a/hadarawgs.view.php b/hadarawgs.view.php
t@@ -55,10 +55,12 @@
$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'],
) );
}
(DIR) diff --git a/hadarawgs_hadarawgs.tpl b/hadarawgs_hadarawgs.tpl
t@@ -3,7 +3,7 @@
<div id="playerboards">
<!-- BEGIN player -->
<div id="playerboard_{PLAYER_ID}" class="playerboard whiteblock">
- <h3 class="playername" style="color:#{PLAYER_COLOR}">{PLAYER_NAME}</h3>
+ <h3 class="playername player-{PLAYER_ANIMAL}" style="color:#{PLAYER_COLOR}">{PLAYER_NAME}</h3>
<div class="resources-container">
<div class="resource-income">
<span class="resource-income-icon token token_income"></span>