static void chc_init(int s, board_t board) { userinfo_t *my = currutmp; setutmpmode(CHC); clear(); chc_warnmsg[0] = 0; chc_my = my->turn; chc_mateid = my->mateid; chc_firststep = 1; chc_init_board(board); chc_redraw(board); chc_cursor.r = 9, chc_cursor.c = 0; add_io(s, 0); if(my->turn) chc_recvmove(s); passwd_query(usernum, &xuser); cuser.chc_win = xuser.chc_win; cuser.chc_lose = xuser.chc_lose + 1; cuser.chc_tie = xuser.chc_tie; cuser.money = xuser.money; passwd_update(usernum, &cuser); getuser(chc_mateid); chc_hiswin = xuser.chc_win; chc_hislose = xuser.chc_lose; chc_histie = xuser.chc_tie; if(!my->turn) { chc_sendmove(s); chc_hislose++; } chc_redraw(board); }
void u_exit(char *mode) { userec_t xuser; int diff = (time(0) - login_start_time) / 60; passwd_query(usernum, &xuser); auto_backup(); setflags(PAGER_FLAG, currutmp->pager != 1); setflags(CLOAK_FLAG, currutmp->invisible); xuser.invisible = currutmp->invisible % 2; xuser.pager = currutmp->pager % 5; if(!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_DENYPOST))) do_aloha("<<下站通知>> -- 我走囉!"); purge_utmp(currutmp); if((cuser.uflag != enter_uflag) || (currmode & MODE_DIRTY) || !diff) { xuser.uflag = cuser.uflag; xuser.numposts = cuser.numposts; if(!diff && cuser.numlogins) xuser.numlogins = --cuser.numlogins; /* Leeym 上站停留時間限制式 */ reload_money(); passwd_update(usernum, &xuser); } log_usies(mode, NULL); }
int passwd_sync_query(int num, userec_t * buf) { if (passwd_query(num, buf) < 0) return -1; buf->money = moneyof(num); if (num == usernum) cuser.money = moneyof(num); return 0; }
int main() { int i, j, k; FILE *fp; int max, item, maxhoroscope; int act[12]; char *name[13] = {"¨d¦Ï", "ª÷¤û", "Âù¤l", "¥¨ÃÉ", "·à¤l", "³B¤k", "¤Ñ¯¯", "¤ÑÃÈ", "®g¤â", "¼¯½~", "¤ô²~", "Âù³½", "" }; char *blk[10] = { " ", "¢j", "¢k", "¢l", "¢m", "¢n", "¢o", "¢p", "¢i", "¢i", }; attach_SHM(); memset(act, 0, sizeof(act)); if(passwd_init()) exit(1); for(k = 1; k <= MAX_USERS; k++) { passwd_query(k, &user); if(!user.userid[0]) continue; switch (user.month) { case 1: if (user.day <= 19) act[9]++; else act[10]++; break; case 2: if (user.day <= 18) act[10]++; else act[11]++; break; case 3: if (user.day <= 20) act[11]++; else act[0]++; break; case 4: if (user.day <= 19) act[0]++; else act[1]++; break; case 5: if (user.day <= 20) act[1]++; else act[2]++; break; case 6: if (user.day <= 21) act[2]++; else act[3]++; break; case 7: if (user.day <= 22) act[3]++; else act[4]++; break; case 8: if (user.day <= 22) act[4]++; else act[5]++; break; case 9: if (user.day <= 22) act[5]++; else act[6]++; break; case 10: if (user.day <= 23) act[6]++; else act[7]++; break; case 11: if (user.day <= 22) act[7]++; else act[8]++; break; case 12: if (user.day <= 21) act[8]++; else act[9]++; break; } } for (i = max = maxhoroscope = 0; i < 12; i++) { if (act[i] > max) { max = act[i]; maxhoroscope = i; } } item = max / 30 + 1; if ((fp = fopen(BBSHOME"/etc/horoscope", "w")) == NULL) { printf("cann't open etc/horoscope\n"); return 1; } for (i = 0; i < 12; i++) { fprintf(fp, " [1;37m%s®y [0;36m", name[i]); for (j = 0; j < act[i] / item; j++) { fprintf(fp, "%2s", blk[9]); } /* ¬°¤Fè¦n¤@¶ */ if (i != 11) fprintf(fp, "%2s [1;37m%d[m\n\n", blk[(act[i] % item) * 10 / item], act[i]); else fprintf(fp, "%2s [1;37m%d[m\n", blk[(act[i] % item) * 10 / item], act[i]); } fclose(fp); return 0; }