-
Notifications
You must be signed in to change notification settings - Fork 0
/
mrjackpocket.action.php
104 lines (80 loc) · 2.6 KB
/
mrjackpocket.action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
*------
* BGA framework: © Gregory Isabelli <[email protected]> & Emmanuel Colin <[email protected]>
* MrJackPocket implementation : © Artem Katnov <[email protected]>
*
* 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.
* -----
*
* mrjackpocket.action.php
*
* MrJackPocket main action entry point
*
*
* 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( "/mrjackpocket/mrjackpocket/myAction.html", ...)
*
*/
class action_mrjackpocket 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 = "mrjackpocket_mrjackpocket";
self::trace("Complete reinitialization of board game");
}
}
public function detective()
{
self::setAjaxMode();
$detectiveId = self::getArg("detectiveId", AT_enum, true, null, ['holmes', 'watson', 'dog']);
$newPos = self::getArg("newPos", AT_posint, true);
$this->game->detective($detectiveId, $newPos, null);
self::ajaxResponse();
}
public function joker()
{
self::setAjaxMode();
$detectiveId = self::getArg("detectiveId", AT_enum, false, null, ['holmes', 'watson', 'dog']);
$newPos = self::getArg("newPos", AT_posint, false, null);
$this->game->joker($detectiveId, $newPos, null);
self::ajaxResponse();
}
public function alibi()
{
self::setAjaxMode();
$this->game->alibi(null);
self::ajaxResponse();
}
public function exchange()
{
self::setAjaxMode();
$taleId1 = self::getArg("taleId1", AT_alphanum, true);
$taleId2 = self::getArg("taleId2", AT_alphanum, true);
$this->game->exchangeTales($taleId1, $taleId2, null);
self::ajaxResponse();
}
public function rotate()
{
self::setAjaxMode();
$taleId = self::getArg("taleId", AT_alphanum, true);
$wallSide = self::getArg("wallSide", AT_alphanum, true);
$this->game->rotateTale($taleId, $wallSide, null);
self::ajaxResponse();
}
public function confirmGameEnd()
{
self::setAjaxMode();
$this->game->confirmGameEnd();
self::ajaxResponse();
}
}