-- define(USER_FLAG_TY_ALL, 0x000f0000); // done
-- define(USER_FLAG_TY_NORM, 0x00010000); // done
-- define(USER_FLAG_TY_SUPER, 0x00020000); // done
+-- define(USER_FLAG_TY_FIRONLY, 0x00200000); // done
-- define(USER_FLAG_TY_SUSPEND, 0x00400000); // done
-- define(USER_FLAG_TY_DISABLE, 0x00800000); // done
INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (1, 'uno', md5('one'), 'uno@pluto.com', CAST (X'00020000' as integer), 0);
INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (2, 'due', md5('two'), 'due@pluto.com', CAST (X'00010000' as integer), 0);
INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (3, 'tre', md5('thr'), 'tre@pluto.com', CAST (X'00010000' as integer), 0);
-INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (4, 'qua', md5('for'), 'qua@pluto.com', CAST (X'00010000' as integer), 0);
+INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (4, 'qua', md5('for'), 'qua@pluto.com', CAST (X'00210000' as integer), 0);
INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (5, 'cin', md5('fiv'), 'cin@pluto.com', CAST (X'00010000' as integer), 0);
function room_sitdown($user, $table_idx)
{
- log_main("room_sitdown ".($user == FALSE ? "USER: FALSE" : "USER: ".$user->name));
-
- $train_app = "";
-
- if ($table_idx > -1 && $table_idx < TABLES_N) {
- $table = $this->table[$table_idx];
-
- // wagon shutdown
- if ($table->wag_own != -1 && $table->player_n == PLAYERS_N) {
- for ($i = 0 ; $i < TABLES_N ; $i++) {
- if ($table->wag_own == $table->player[$i]) {
- $train_app = sprintf("tra.rem(%d); ", $table_idx);
- $table->wag_reset(time());
- break;
- }
- }
- }
- }
-
- for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
- $ret = "";
- $user_cur = $this->user[$i];
- if ($user_cur->sess == '' || $user_cur->stat != 'room')
- continue;
+ log_main("room_sitdown ".($user == FALSE ? "USER: FALSE" : "USER: ".$user->name));
- $ret = "gst.st = ".($user_cur->step+1)."; ".$train_app;
- if ($table_idx > -1)
- $ret .= $this->table_content($user_cur, $table_idx);
- $ret .= $this->standup_content($user_cur);
+ $train_app = "";
- if ($user->idx_get() == $i) {
- $ret .= 'subst = "sitdown"; tra.hide(); ';
- // clean the action buttons in other tables
- for ($e = 0 ; $e < TABLES_N ; $e++) {
- // $ret .= table_act_content(FALSE, 0, $e, $user_cur->table, FALSE);
- $ret .= $this->table[$e]->act_content($user_cur);
- }
+ if ($table_idx > -1 && $table_idx < TABLES_N) {
+ $table = $this->table[$table_idx];
+
+ // wagon shutdown
+ if ($table->wag_own != -1 && $table->player_n == PLAYERS_N) {
+ for ($i = 0 ; $i < TABLES_N ; $i++) {
+ if ($table->wag_own == $table->player[$i]) {
+ $train_app = sprintf("tra.rem(%d); ", $table_idx);
+ $table->wag_reset(time());
+ break;
+ }
+ }
+ }
}
- else if ($table_idx > -1) {
- if ($table->player_n == PLAYERS_N) {
- // $ret .= table_act_content(($user_cur->subst == 'standup'), PLAYERS_N, $table_idx, $user_cur->table,
- /// ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH));
- $ret .= $table->act_content($user_cur);
- }
+
+ for ($i = 0 ; $i < MAX_PLAYERS ; $i++) {
+ $ret = "";
+ $user_cur = $this->user[$i];
+ if ($user_cur->sess == '' || $user_cur->stat != 'room')
+ continue;
+
+ $ret = "gst.st = ".($user_cur->step+1)."; ".$train_app;
+ if ($table_idx > -1)
+ $ret .= $this->table_content($user_cur, $table_idx);
+ $ret .= $this->standup_content($user_cur);
+
+ if ($user->idx_get() == $i) {
+ $ret .= 'subst = "sitdown"; tra.hide(); ';
+ // clean the action buttons in other tables
+ for ($e = 0 ; $e < TABLES_N ; $e++) {
+ $ret .= $this->table[$e]->act_content($user_cur);
+ }
+ }
+ else if ($table_idx > -1) {
+ if ($table->player_n == PLAYERS_N) {
+ // $ret .= table_act_content(($user_cur->subst == 'standup'), PLAYERS_N, $table_idx, $user_cur->table,
+ /// ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH));
+ $ret .= $table->act_content($user_cur);
+ }
+ }
+ $user_cur->comm[$user_cur->step % COMM_N] = $ret;
+ $user_cur->step_inc();
}
- $user_cur->comm[$user_cur->step % COMM_N] = $ret;
- $user_cur->step_inc();
- }
}
function chatt_send($user, $mesg)
define('USER_FLAG_TY_SUPER', 0x020000); // done
define('USER_FLAG_TY_CERT', 0x040000); // done
// ... other usefull status ...
+define('USER_FLAG_TY_FIRONLY', 0x200000); // done
define('USER_FLAG_TY_SUSPEND', 0x400000); // done
define('USER_FLAG_TY_DISABLE', 0x800000); // done
'en' => '<b>The table is only just opened, you will sit down in '), // FIXME
'tabwait_b'=> array( 'it' => ' secondi.</b>',
'en' => ' seconds.</b>'),
+ 'mustfirst'=> array( 'it' => '<b>Il tuo utente può sedersi al tavolo solo per primo.</b>',
+ 'en' => '<b>Your can sit down as first user only.' ),
'pollmust' => array( 'it' => '<b>Per partecipare al sondaggio devi essere autenticato.</b>',
'en' => '<b>To vote for the poll you have to be authenticated</b>'),
'pollnone' => array( 'it' => '<br><br>Al momento non è attivo alcun sondaggio.',
$table_idx = (int)$argz[1];
$table = &$room->table[$table_idx];
- if ($G_shutdown || $table->wakeup_time > $curtime ||
- ($table->auth_only && (($user->flags & USER_FLAG_AUTH) == 0)) ) {
- $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
-
- /* MLANG: "<b>Il server sta per essere riavviato, non possono avere inizio nuove partite.</b>", "<b>Il tavolo a cui volevi sederti richiede autentifica.</b>", "<b>Il tavolo si è appena liberato, ci si potrà sedere tra %d secondi.</b>" */
- if ($G_shutdown) {
- $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['shutmsg'][$G_lang]);
- }
- else if ($table->auth_only && (($user->flags & USER_FLAG_AUTH) == 0)) {
- $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]);
- }
- else {
- $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s%d%s");', $dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang], $table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]);
- }
+ $not_allowed_msg = "";
+ if ($G_shutdown) {
+ $not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"],"%s");',
+ $dt, NICKSERV, $mlang_indwr['shutmsg'][$G_lang]);
+ }
+ else if ($table->wakeup_time > $curtime) {
+ $not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"],"%s%d%s");',
+ $dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang],
+ $table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]);
+ }
+ else if ($table->auth_only && (($user->flags & USER_FLAG_AUTH) == 0)) {
+ $not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"],"%s");',
+ $dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]);
+ }
+ else if ($user->flags & USER_FLAG_TY_FIRONLY && $table->player_n > 0) {
+ $not_allowed_msg = sprintf('chatt_sub("%s", [2, "%s"], "%s");',
+ $dt, NICKSERV, $mlang_indwr['mustfirst'][$G_lang]);
+ }
+ if ($not_allowed_msg != "") {
+ $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ".$not_allowed_msg;
$user->step_inc();
return TRUE;
}