JPHC6PBQJCGZ3B4LKX7C3XZOYP6UTHWV5PU5EXZ27TTXYZY3AG4AC
V5OW3Q4IOFG5YIRAWE7J3HDTEBOX2EW7AHVHKFH2XG7I2XXH6SMAC
JGGVCPUZDY2ZU6EZ72YHJSQKBIOYZPLGWHAJIMSH5ZN3WBWDKJWQC
2KCPYEJPVD4GH2WZIVQY5MY6DSVHGQ2IOZ3V7WQ5Q267B4L6KBUQC
ZXBDOUETFSXTFY6J5LIMXBCNMDW6NTUTZ7HZZ6ND7BNUKISR74FAC
OPI6W7BO4V3R5WGEVN4USOHVPUV5PVWGKYBMCRU4VQOI7F7RCF5QC
EZYBNJFUNOS3LIU6ILXN7MFKLVW4SDXW6K5T4YFKFZ2R4UWSFUXAC
5I4UCQOTFNIXNO3IEJBPOHAHI63WOS7ZCOGHWJ47IK6MDJ6CBW6AC
NRK37A4NNGLF53STW5RJDHUEP6OKKJORJZL3HYVOKD7OW4QBO5XAC
NDDFOS5624OS3JXFPE46C2VBGU6XYA2XOOP7X5GF26HMDPYLOQXQC
ISWDRBPZCEGJSXNXHML7D7XDW4N3Z7MXOF4OS7UHC6U2GVXFHYZQC
GM4D5JXIKKI7N3HG5NFHPKQ2BRSXCV2XFENRCAT2YZZMRUYQ7KZQC
4LMTBPV7JT446YP5RLF6HT7246BY75U5V35JTEIK4PT5NEPKNNKAC
KLQKDNMZA776M73IWLBYAHXLESBVKE44YJS2IAAMYJJLOC3IJMOAC
// Cards in player hand (the other player's case cards)
$result['hand'] = $this->cards->getCardsInLocation('hand', $current_player_id);
// Evidence cards on display
$result['evidence_display'] = $this->cards->getCardsInLocation('evidence_display');
$result['evidence_discard'] = $this->cards->getCardsInLocation('discard');
$result['player_display_cards'] = $this->cards->getCardsInLocation('player_display');
$result['tiles'] = $this->cards->getCardsInLocation('locslot');
function getPrivateGameInfos($player_id)
{
return array(
// Cards in player hand (the other player's case cards)
'hand' => $this->cards->getCardsInLocation('hand', $player_id)
);
}
function getPublicGameInfos()
{
return array(
// Evidence cards on display
'evidence_display' => $this->cards->getCardsInLocation('evidence_display'),
'evidence_discard' => $this->cards->getCardsInLocation('discard'),
'player_display_cards' => $this->cards->getCardsInLocation('player_display'),
'tiles' => $this->cards->getCardsInLocation('locslot')
);
}
// TODO: Warn the active player when it's their last chance to solve,
// i.e. when they are the last one with an unsolved case in the current
// minigame.
// TODO: Warn the next active player when it's their last chance to
// solve, i.e. when they are the last one with an unsolved case in the
// current minigame.
}
// Cards in player's hand
for (i in this.gamedatas.hand) {
var card = this.gamedatas.hand[i];
this.playerHand.addToStockWithId(card.type_arg, card.id);
}
// Put evidence cards on the table
for (i in this.gamedatas.evidence_display) {
var card = this.gamedatas.evidence_display[i];
this.evidenceDisplay.addToStockWithId(card.type_arg, card.id);
this.addTooltip('evidence_item_' + card.id, _(this.gamedatas.cardinfos[card.type_arg].name), _('Follow this evidence…'));
}
for (i in this.gamedatas.evidence_discard) {
var card = this.gamedatas.evidence_discard[i];
this.evidenceDiscard.addToStockWithId(card.type_arg, card.id);
}
for (i in this.gamedatas.player_display_cards) {
// All cards have same location 'player_display' with `location_arg` being the player_id
var card = this.gamedatas.player_display_cards[i];
this.playerDisplays[card.location_arg].addToStockWithId(card.type_arg, card.id);
for (i in this.gamedatas.tiles) {
var tile = this.gamedatas.tiles[i];
this.tiles.addToStockWithId(tile.type_arg, tile.id);
dojo.place($(this.tiles.getItemDivId(tile.id)), $('locslot_' + tile.location_arg));
}
// Place all the created stuff on the table.
this.placePlayerHand(this.gamedatas.hand);
this.placeEvidenceCards(
this.gamedatas.evidence_display,
this.gamedatas.evidence_discard,
this.gamedatas.player_display_cards,
);
this.placeTiles(this.gamedatas.tiles);
validateCaseSelection: function (opts) {
/**
* Place evidence cards (all public cards). Used during setup and on newMinigame.
*/
placeEvidenceCards: function(display, discard, player_display_cards) {
// Put evidence cards on the table
this.evidenceDisplay.removeAll();
for (i in display) {
var card = display[i];
this.evidenceDisplay.addToStockWithId(card.type_arg, card.id);
this.addTooltip('evidence_item_' + card.id, _(this.gamedatas.cardinfos[card.type_arg].name), _('Follow this evidence…'));
}
this.evidenceDiscard.removeAll();
for (i in discard) {
var card = discard[i];
this.evidenceDiscard.addToStockWithId(card.type_arg, card.id);
}
for (var player_id in this.gamedatas.players) {
this.playerDisplays[player_id].removeAll();
}
for (i in player_display_cards) {
// All cards have same location 'player_display' with `location_arg` being the player_id
var card = player_display_cards[i];
this.playerDisplays[card.location_arg].addToStockWithId(card.type_arg, card.id);
}
},
/**
* Place cards in player's (private) hand.
*/
placePlayerHand: function (hand) {
this.playerHand.removeAll();
for (i in hand) {
var card = hand[i];
this.playerHand.addToStockWithId(card.type_arg, card.id);
}
},
/**
* Place tiles on the table.
*/
placeTiles: function (tiles) {
for (i in tiles) {
var tile = tiles[i];
this.tiles.addToStockWithId(tile.type_arg, tile.id);
dojo.place($(this.tiles.getItemDivId(tile.id)), $('locslot_' + tile.location_arg));
}
},
validateCaseSelection: function(opts) {
dojo.subscribe('newEvidence', this, "notif_newEvidence");
dojo.subscribe('evidenceExhausted', this, "notif_evidenceExhausted");
dojo.subscribe('evidenceReplenished', this, "notif_evidenceReplenished");
dojo.subscribe('newMinigame', this, "notif_newMinigame");
dojo.subscribe('newMinigamePrivate', this, "notif_newMinigamePrivate");
// 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 );
//
notif_evidenceExhausted: function(notif) {
this.evidenceDiscard.removeAll();
notif_newEvidence: function(notif) {
if (notif.args.card_id) {
this.evidenceDisplay.addToStockWithId(notif.args.card_type, notif.args.card_id);
}
notif_evidenceReplenished: function(notif) {
this.evidenceDisplay.addToStockWithId(notif.args.card_type, notif.args.card_id);
},
notif_newMinigame: function (notif) {
// TODO: set new startplayer in UI
this.enableAllPlayerPanels();
this.placeEvidenceCards(notif.args.evidence_display, [], []);
this.placeTiles(notif.args.tiles);
},
notif_newMinigamePrivate: function (notif) {
this.placePlayerHand(notif.args.hand);