Ejemplo n.º 1
0
static int
backnumbertitle()
{

	if (chkmail())
		showtitle("阅读过刊", "[您有信件,请按 w 查看信件]");
	else
		showtitle("阅读过刊", MY_BBS_NAME);
	prints
	    ("离开[\033[1;32m←\033[m,\033[1;32me\033[m]  选择[\033[1;32m↑\033[m,\033[1;32m↓\033[m]  阅读"
	     "[\033[1;32m→\033[m,\033[1;32mRtn\033[m] 求助[\033[1;32mh\033[m]\033[m\n");
	prints("\033[1;44m编号   %-12s %6s  %-50s\033[m\n", "刊登者", "日期",
	       "标题");
	clrtobot();
	return 0;
}
Ejemplo n.º 2
0
int p_five()
{
   int i=0;
   srandom(time(0));

restart:
  setutmpmode(FIVE);
  showtitle("天地五子棋", BOARDNAME);

  outs("┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐\n");
for(sum=0;sum<20;sum++)
  outs("├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤\n");
  outs("└┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┘\n");


   gotoxy(48,1); outs("=-=-=-=-=-=-=-=-=-=");
   gotoxy(48,2); outs("|   天地五子棋    |");
   gotoxy(48,3); outs("=-=-=-=-=-=-=-=-=-=");
   who(0); who(1);

   gotoxy(45,17); outs(" ↓↑→← >> 控制方向");
   gotoxy(45,18); outs("  空白鍵  >> 確定");
   gotoxy(45,19); outs("     2    >> 二號玩家換人");
   gotoxy(45,20); outs("     b    >> 悔棋");
   gotoxy(45,21); outs("     r    >> 重新開始");
   gotoxy(45,22); outs("     q    >> 離開");

   for(m=1;m<22;m++)
    for(n=1;n<22;n++)
      chess[m][n]=0;

   sum=fturn=0;
   m=n=mm=nn=11;
   for(;;)
   {
     if(role[fturn]==1)
     {
       int tmp=fplayer(fturn+1);
       if(tmp==1) goto restart;
       if(tmp==2) return;
     }
     else
     {
       int hk=think(fturn+1);
       if(hk)
       {
         i=show_win(hk);
         if(i=='q'||i=='n') return;
         goto restart;
       }
     }
     fturn=abs(fturn-1);
   }
}
Ejemplo n.º 3
0
static int
backnumbertitle()
{

	showtitle("ÔĶÁ¹ý¿¯", MY_BBS_NAME);
	prints
	    ("À뿪[¡û,e]  Ñ¡Ôñ[¡ü,¡ý]  ÔĶÁ"
	     "[¡ú,Rtn] ÇóÖú[h]\n");
	prints("±àºÅ   %-12s %6s  %-50s\n", "¿¯µÇÕß", "ÈÕÆÚ", "±êÌâ");
	clrtobot();
	return 0;
}
Ejemplo n.º 4
0
static int
do1984title()
{

	showtitle("审查文章", MY_BBS_NAME);
	prints
	    ("离开[\033[1;32m←\033[m,\033[1;32me\033[m]  选择[\033[1;32m↑\033[m,\033[1;32m↓\033[m]  阅读"
	     "[\033[1;32m→\033[m,\033[1;32mRtn\033[m] 求助[\033[1;32mh\033[m]\033[m\n");
	prints("\033[1;44m编号   %-12s %6s  %-50s\033[m\n", "刊登者", "日期",
	       "标题");
	clrtobot();
	return 0;
}
Ejemplo n.º 5
0
Archivo: dark.c Proyecto: yrchen/Athena
start(user_info *uin)
{
 char x,y,xx,yy,tmp,genbuf[255],n[8][4]=
       {{3,5,5,7},{7,9,9,11},{11,13,13,15},{15,15,15,15},
        {67,69,69,71},{71,73,73,75},{75,77,77,79},{79,79,79,79}};
 int i,j,k;
 FILE *fs;

 clear();
 setutmpmode(DARK);
 showtitle("天地暗棋", BOARDNAME);

 move(1,0);
 fs=fopen("game/dark.i","r"); //* 改成自己的路徑
 while (fgets(genbuf, 254, fs)) prints(genbuf);
 fclose(fs);

 sprintf(genbuf, BBSHOME "/home/%s/.dark", currutmp->userid);
  if(fs=fopen(genbuf, "r")) {
   fscanf(fs, "%d %d %d", &i, &j, &k);
   fclose(fs); 
 } else i=j=k=0;
 printtt(19, 26, "%-13s", currutmp->userid);
 sprintf(genbuf,"%d-%d-%d",i,j,k);
 strncat(genbuf,"        ",13-strlen(genbuf));
 printtt(20, 26, "%s", genbuf);

 sprintf(genbuf, BBSHOME "/home/%s/.dark", uin->userid);
 if(fs=fopen(genbuf, "r")) {
   fscanf(fs, "%d %d %d", &i, &j, &k);
   fclose(fs);
 } else i=j=k=0;
 printtt(19, 87, "%-13s", uin->userid);
 sprintf(genbuf,"%d-%d-%d",i,j,k);
 strncat(genbuf,"        ",13-strlen(genbuf));
 printtt(20, 87, "%s", genbuf);
 refresh();

 memcpy(chess,n,strlen((char *)n));
 for(i=0;i<30000;i++) {
  x=random()%4; xx=random()%4;
  y=random()%8; yy=random()%8;
  tmp=chess[yy][xx];
  chess[yy][xx]=chess[y][x];
  chess[y][x]=tmp;
 }
}
Ejemplo n.º 6
0
void firsttitle(const char *title)
{
	extern int mailXX; //main.c
	extern char BoardName[]; //main.c
	char middoc[30];

	if (chkmail())
		//% strcpy(middoc, strstr(title, "讨论区列表") ? "[您有信件,按 M 看新信]"
		strcpy(middoc, strstr(title, "\xcc\xd6\xc2\xdb\xc7\xf8\xc1\xd0\xb1\xed") ? "[\xc4\xfa\xd3\xd0\xd0\xc5\xbc\xfe\xa3\xac\xb0\xb4 M \xbf\xb4\xd0\xc2\xd0\xc5]"
				//% : "[您有信件]");
				: "[\xc4\xfa\xd3\xd0\xd0\xc5\xbc\xfe]");
	else if (mailXX == 1)
		//% strcpy(middoc, "[信件过量,请整理信件!]");
		strcpy(middoc, "[\xd0\xc5\xbc\xfe\xb9\xfd\xc1\xbf\xa3\xac\xc7\xeb\xd5\xfb\xc0\xed\xd0\xc5\xbc\xfe!]");
	else
		strlcpy(middoc, BoardName, sizeof(middoc));

	showtitle(title, middoc);
}
Ejemplo n.º 7
0
int
pip_live_again()
{
    char genbuf[80];
    time_t now;
    int tm;

    tm = (d.bbtime) / 60 / 30;

    clear();
    showtitle("小鸡复活手术中", BBS_FULL_NAME);

    now = time(0);
    sprintf(genbuf, "\033[1;33m%s %-11s的小鸡 [%s二代] 复活了!\033[m\n",
            Cdate(now), getCurrentUser()->userid, d.name);
    pip_log_record(genbuf);

    /*
     * 身体上的设定
     */
    d.death = 0;
    d.maxhp = d.maxhp * 3 / 4 + 1;
    d.hp = d.maxhp / 2 + 1;
    d.tired = 20;
    d.shit = 20;
    d.sick = 20;
    d.wrist = d.wrist * 3 / 4;
    d.weight = 45 + 10 * tm;

    /*
     * 钱减到五分之一
     */
    d.money = d.money / 5;

    /*
     * 战斗能力降一半
     */
    d.attack = d.attack * 3 / 4;
    d.resist = d.resist * 3 / 4;
    d.maxmp = d.maxmp * 3 / 4;
    d.mp = d.maxmp / 2;

    /*
     * 变的不快乐
     */
    d.happy = 0;
    d.satisfy = 0;

    /*
     * 评价减半
     */
    d.social = d.social * 3 / 4;
    d.family = d.family * 3 / 4;
    d.hexp = d.hexp * 3 / 4;
    d.mexp = d.mexp * 3 / 4;

    /*
     * 武器掉光光
     */
    d.weaponhead = 0;
    d.weaponrhand = 0;
    d.weaponlhand = 0;
    d.weaponbody = 0;
    d.weaponfoot = 0;

    /*
     * 食物剩一半
     */
    d.food = d.food / 2;
    d.medicine = d.medicine / 2;
    d.bighp = d.bighp / 2;
    d.cookie = d.cookie / 2;

    d.liveagain += 1;

    temppress("小鸡器官重建中!");
    temppress("小鸡体质恢复中!");
    temppress("小鸡能力调整中!");
    temppress("恭禧您,你的小鸡又复活罗!");
    pip_write_file();
    return 0;
}
Ejemplo n.º 8
0
static int
a_showmenu(menu_t * pm)
{
    char           *title, *editor;
    int             n;
    fileheader_t   *item;
    time4_t         dtime;

    showtitle("精華文章", pm->mtitle);
    prints("   " ANSI_COLOR(1;36) "編號    標      題%56s" ANSI_RESET,
	   "編    選      日    期");

    if (!pm->num)
    {
	outs("\n  《精華區》尚在吸取天地間的日月精華中... :)");
    }
    else
    {
	char buf[PATHLEN];

	// determine if path is valid.
	if (!a_loadname(pm))
	    return 0;

	for (n = 0; n < p_lines && pm->page + n < pm->num; n++) {
	    int flTagged = 0;
	    item = &pm->header[n];
	    title = item->title;
	    editor = item->owner;
	    /*
	     * Ptt 把時間改為取檔案時間 dtime = atoi(&item->filename[2]);
	     */
	    snprintf(buf, sizeof(buf), "%s/%s", pm->path, item->filename);
	    if(copyqueue_querysize() > 0 && copyqueue_fileinqueue(buf))
	    {
		flTagged = 1;
	    }
	    dtime = dasht(buf);
	    a_timestamp(buf, &dtime);
	    prints("\n%6d%c%c%-47.46s%-13s[%s]", pm->page + n + 1,
		   (item->filemode & FILE_BM) ? 'X' :
		   (item->filemode & FILE_HIDE) ? ')' : '.',
		   flTagged ? 'c' : ' ',
		   title, editor,
		   buf);
	}
    }

    move(b_lines, 0);
    if(copyqueue_querysize() > 0)
    {		// something in queue
	char buf[STRLEN];
	snprintf(buf, sizeof(buf),  "【已標記(複製) %d 項】", copyqueue_querysize());
	vs_footer(buf, pm->level == 0 ?
		" (c)標記/複製 - 無管理權限,無法貼上 " :
		" (c)標記/複製 (p)貼上/取消/重設標記 (a)附加至文章後\t(q/←)離開 (h)說明");
    }
    else if(pm->level)
    {		// BM
	vs_footer(" 【板  主】 ",
		" (n)新增文章 (g)新增目錄 (e)編輯檔案\t(q/←)離開 (h)說明");
    }
    else
    {		// normal user
	vs_footer(" 【功\能鍵】 ",
		" (k↑j↓)移動游標 (enter/→)讀取資料\t(q/←)離開 (h)說明");
    }
    return 1;
}
Ejemplo n.º 9
0
int p_seven()
{
    char buf1[8],log[80];
    char *kind[9]= {"¯QÀs","³æ­F","¨ß­F","¤T±ø","¶¶¤l","¦Pªá","¸¬Äª",
                    "ÅK¤ä","¬h¤B"
                   };
    char *poker[52]= {"¢±","¢±","¢±","¢±","¢²","¢²","¢²","¢²",
                      "¢³","¢³","¢³","¢³","¢´","¢´","¢´","¢´","¢µ","¢µ","¢µ","¢µ",
                      "¢¶","¢¶","¢¶","¢¶","¢·","¢·","¢·","¢·","¢¸","¢¸","¢¸","¢¸",
                      "10","10","10","10","¢Ø","¢Ø","¢Ø","¢Ø","¢ß","¢ß","¢ß","¢ß",
                      "¢Ù","¢Ù","¢Ù","¢Ù","¢Ï","¢Ï","¢Ï","¢Ï"
                     };
    int cardlist[52]= {0};
    int mark[2]= {7,7}, set[6],key,tax=0; /* tax ¬°ª±®aĹ®É©âªºµ| */
    int i,j,k,x,m,ch,z=1;
    int win,color,color2,bet;
    int host_card[7]= {0}, guest_card[7]= {0};

    time_t now = time(0);
    time(&now);

    while(-1) {
        clear();
        setutmpmode(SEVENCARD);
        showtitle("½ä«°¤C±i", BoardName);
        show_money(bet=0);
        do
        {
            getdata(21, 0,"­n¤Uª`¦h¤Ö©O(¤W­­250000)? «ö Enter Â÷¶}>", buf1, 7, 1, 0);
            bet=atoi(buf1);
            if(bet<0) bet=0;
        } while(bet>250000);
        if(!bet) return 0;
        if(bet>cuser.silvermoney)
        {
            pressanykey("§Aªº²{ª÷¤£°÷³á.. :)");
            return 0;
        }

        demoney(bet);
        show_money(bet);
        move(21,0);
        prints("(«ö ¡ô¡õ¡ö¡÷ ©Î ijkl ¿ïµP, ¿ï¦n«ö enter ÅuµP)");

        for(i=0; i<52; i++) cardlist[i]=0;
        mark[0]=mark[1]=7;
        z=1;

        for(i=1; i<=52; i++) {
            m=0;
            do {
                j=(time(0)+cuser.silvermoney+random())%52;
                if (cardlist[j]==0) {
                    cardlist[j]=i;
                    m=1;
                }
            } while(m==0);
        };
        for(i=0; i<52; i++)cardlist[i]--; /* ¬~µP */

        j=0;
        for(i=0; i<7; i++) {
            host_card[i]=cardlist[j];
            j++;
            guest_card[i]=cardlist[j];
            j++;
        }        /* µo«e¤Q¥|±iµP */

        for(i=0; i<7; i++) {
            for(j=0; j<(6-i); j++) {
                if(guest_card[j]>guest_card[j+1]) {
                    x=guest_card[j];
                    guest_card[j]=guest_card[j+1];
                    guest_card[j+1]=x;
                }
                if(host_card[j]>host_card[j+1]) {
                    x=host_card[j];
                    host_card[j]=host_card[j+1];
                    host_card[j+1]=x;
                }
            }
        }        /* ±Æ§Ç */
        move(1,0);
        prints("¥»¹CÀ¸¥Ñ¯îÂÕ¤Û¹Ò(weird.twbbs.org)¯¸ªø weiren ³]­p´£¨Ñ! ¯S¦¹·PÁÂ!!\n");
        prints("e-mail: [email protected]");

        move(3,0);
        prints("¢~¢w¢~¢w¢~¢w¢~¢w¢~¢w¢~¢w¢~¢w¢w¢w¢¡");
        move(4,0);
        prints("¢x  ¢x  ¢x  ¢x  ¢x  ¢x  ¢x      ¢x");
        move(5,0);
        prints("¢x  ¢x  ¢x  ¢x  ¢x  ¢x  ¢x      ¢x");
        move(6,0);
        prints("¢x  ¢x  ¢x  ¢x  ¢x  ¢x  ¢x      ¢x");
        move(7,0);
        prints("¢x  ¢x  ¢x  ¢x  ¢x  ¢x  ¢x      ¢x");
        move(8,0);
        prints("¢x  ¢x  ¢x  ¢x  ¢x  ¢x  ¢x      ¢x");
        move(9,0);
        prints("¢¢¢w¢¢¢w¢¢¢w¢¢¢w¢¢¢w¢¢¢w¢¢¢w¢w¢w¢£");

        for(i=0; i<7; i++) {
            print_Scard(guest_card[i],11,0+4*i);  /* ¦L¥X«e¤C±iµP */
        }

        j=2;
        k=0;
        x=0;
        move(15,2);
        do {
            ch=igetkey();
            switch (ch)
            {
            case KEY_RIGHT:
            case 'l':
                j+=4;
                if(j>26)j=26;
                break;
            case KEY_LEFT:
            case 'j':
                j-=4;
                if(j<2)j=2;
                break;
            case KEY_UP:
            case 'i':
                k=(j-2)/4;
                if(x<2&&mark[0]!=k&&mark[1]!=k) {
                    if(mark[0]==7)mark[0]=k;
                    else mark[1]=k;
                    x++;
                    cursor_show(15,j);
                }
                break;
            case KEY_DOWN:
            case 'k':
                k=(j-2)/4;
                if(mark[0]==k) {
                    mark[0]=7;
                    x--;
                }
                if(mark[1]==k) {
                    mark[1]=7;
                    x--;
                }
                cursor_clear(15,j);
                break;
            case 13:   /* ¿ï¥X¨â±i«á«ö enter */
                if(x==2)z=0;
                break;
                prints("¥»¹CÀ¸¥Ñ¯îÂÕ¤Û¹Ò(weird.twbbs.org)¯¸ªø weiren ³]­p\n");
                prints("e-mail: [email protected]");
            }
            move(15,j);
        } while(z==1);

        if(mark[0]>mark[1]) {
            i=mark[0];
            mark[0]=mark[1];
            mark[1]=i;
        }
        for(i=1; i<18; i++) {
            move(i,0);
            clrtoeol();
        }
        print_Scard(guest_card[mark[0]],11,0);
        print_Scard(guest_card[mark[1]],11,4);
        j=0;
        for(i=0; i<7; i++) {
            if(i!=mark[0]&&i!=mark[1]) {
                print_Scard(guest_card[i],11,16+j*4);
                set[j]=guest_card[i];
                j++;
            }
        }                   /* ¦L¥Xª±®a¤À¦n¨â°ô«áªºµP */
        set[5]=5;
        if(diedragon(set,guest_card[mark[0]],guest_card[mark[1]])==1)
        {
            ;
            pressanykey("­ËÀs!");
            continue;
        }
        if(guest_card[mark[0]]/4==guest_card[mark[1]]/4)x=1;

        key=find_host(host_card);
        print_hostcard(host_card,key,log);
        i=bigsmall(host_card,guest_card,key,mark);
        switch(i) {
        case 0:
            win=2;
            color=41;
            color2=41;
            break; /* ª±®a duA duB ¬ÒĹ  */
        case 1:
            win=1;
            color=41;
            color2=47;
            break; /*      duA Ĺ duB ¿é */
        case 2:
            win=1;
            color=47;
            color2=41;
            break; /*      duA ¿é duB Ĺ */
        case 3:
            win=0;
            color=47;
            color2=47;
            break; /*      ¨â½ä¬Ò¿é */
        }
        game_log(SEVENCARD,"§ÚªºµP%s%s%s..¹q¸£%s..%s..%d",poker[guest_card[mark[0]]],
                 x==1?"­F":poker[guest_card[mark[1]]],kind[find_all(set)],log,
                 win?(win==1?"¥­¤â":"ŤF"):"¿é¤F",bet);
        move(15,4);
        prints("[1;%d;%dm   %s%s     ¢x  ¢x  [1;%d;%dm         %s         "
               ,color,  color==41?33:30
               ,poker[guest_card[mark[0]]],x==1?"­F":poker[guest_card[mark[1]]]
               ,color2, color2==41?33:30
               ,kind[find_all(set)]);
        i=bet*2-bet/100*tax;
        switch(win) {
        case 2:
            pressanykey("§AŤF %d !!.. :D",i-bet);
            inmoney(i);
            break;
        case 1:
            pressanykey("¥­¤â!!..");
            inmoney(bet);
            break;
        case 0:
            pressanykey("§A¿é¤F³á.. :))" );
            break;
        }
    }
}
Ejemplo n.º 10
0
int pip_weapon_doing_menu(int variance,int type,const struct weapon *p)
{
    time_t now;
    register int n = 0;
    register char *s;
    char buf[256];
    char ans[5];
    char shortbuf[100];
    const static char menutitle[5][11] = { "头部装备区", "右手装备区", "左手装备区", "身体装备区",
                                           "足部装备区"
                                         };
    int pipkey;
    char choicekey[5];
    int choice;

    do {
        clear();
        showtitle(menutitle[type], BBS_FULL_NAME);
        show_weapon_pic(0);
        /*   move(10,2);
           sprintf(buf,"\033[1;37m现今能力:体力Max:\033[36m%-5d\033[37m  法力Max:\033[36m%-5d\033[37m  攻击:\033[36m%-5d\033[37m  防御:\033[36m%-5d\033[37m  速度:\033[36m%-5d \033[m",
                   d.maxhp,d.maxmp,d.attack,d.resist,d.speed);
           prints(buf);*/
        move(11, 2);
        sprintf(buf,
                "\033[1;37;41m [NO]  [器具名]  [体力]  [法力]  [速度]  [攻击]  [防御]  [速度]  [售  价] \033[m");
        prints(buf);
        move(12, 2);
        sprintf(buf,
                " \033[1;31m——\033[37m白色 可以购买\033[31m——\033[32m绿色 拥有装备\033[31m——\033[33m黄色 钱钱不够\033[31m——\033[35m紫色 能力不足\033[31m——\033[m");
        prints(buf);

        n = 0;
        while ((s = p[n].name)!=0) {
            move(13 + n, 2);
            if (variance != 0 && variance == (n)) { /*本身有的 */
                sprintf(buf,
                        "\033[1;32m (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d\033[m",
                        n, p[n].name, p[n].needmaxhp,
                        p[n].needmaxmp, p[n].needspeed,
                        p[n].attack, p[n].resist, p[n].speed,
                        p[n].cost);
            } else if (d.maxhp < p[n].needmaxhp || d.maxmp < p[n].needmaxmp || d.speed < p[n].needspeed) { /*能力不足 */
                sprintf(buf,
                        "\033[1;35m (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d\033[m",
                        n, p[n].name, p[n].needmaxhp,
                        p[n].needmaxmp, p[n].needspeed,
                        p[n].attack, p[n].resist, p[n].speed,
                        p[n].cost);
            }

            else if (d.money < p[n].cost) { /*钱不够的 */
                sprintf(buf,
                        "\033[1;33m (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d\033[m",
                        n, p[n].name, p[n].needmaxhp,
                        p[n].needmaxmp, p[n].needspeed,
                        p[n].attack, p[n].resist, p[n].speed,
                        p[n].cost);
            } else {
                sprintf(buf,
                        "\033[1;37m (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d\033[m",
                        n, p[n].name, p[n].needmaxhp,
                        p[n].needmaxmp, p[n].needspeed,
                        p[n].attack, p[n].resist, p[n].speed,
                        p[n].cost);
            }
            prints(buf);
            n++;
        }
        move(b_lines, 0);
        sprintf(buf,
                "\033[1;44;37m  武器购买选单  \033[46m  [B]购买武器  [S]卖掉装备  [W]个人资料  [Q]跳出:            \033[m");
        prints(buf);
        now = time(0);
        pip_time_change(now);
        pipkey = igetkey();
        pip_time_change(now);

        switch (pipkey) {
            case 'B':
            case 'b':
                move(b_lines - 1, 1);
                sprintf(shortbuf, "想要购买啥呢? 你的钱钱[%d]元:[数字]",
                        d.money);
                prints(shortbuf);
#ifdef MAPLE
                getdata(b_lines - 1, 1, shortbuf, choicekey, 4, LCECHO,
                        "0");
#else
                getdata(b_lines-1,1,shortbuf,choicekey,4,DOECHO,NULL,true);
                if ((choicekey[0] >= 'A') && (choicekey[0] <= 'Z'))
                    choicekey[0] = choicekey[0] | 32;
#endif    // END MAPLE
                choice = atoi(choicekey);
                if (choice >= 0 && choice <= n) {
                    move(b_lines - 1, 0);
                    clrtoeol();
                    move(b_lines - 1, 1);
                    if (choice == 0) { /*解除 */
                        sprintf(shortbuf, "放弃购买...");
                        temppress(shortbuf);
                    }

                    else if (variance == choice) { /*早已经有啦 */
                        sprintf(shortbuf, "你早已经有 %s 罗",
                                p[variance].name);
                        temppress(shortbuf);
                    }

                    else if (p[choice].cost >= (d.money + p[variance].sell)) { /*钱不够 */
                        sprintf(shortbuf,
                                "这个要 %d 元,你的钱不够啦!",
                                p[choice].cost);
                        temppress(shortbuf);
                    }

                    else if (d.maxhp < p[choice].needmaxhp || d.maxmp < p[choice].needmaxmp || d.speed < p[choice].needspeed) { /*能力不足 */
                        sprintf(shortbuf,
                                "需要HP %d MP %d SPEED %d 喔",
                                p[choice].needmaxhp,
                                p[choice].needmaxmp,
                                p[choice].needspeed);
                        temppress(shortbuf);
                    } else { /*顺利购买 */

                        sprintf(shortbuf,
                                "你确定要购买 %s 吗?($%d) [y/N]",
                                p[choice].name, p[choice].cost);
#ifdef MAPLE
                        getdata(b_lines - 1, 1, shortbuf, ans,
                                2, 1, 0);
#else
                        getdata(b_lines-1,1,shortbuf,ans,2,DOECHO,NULL,true);
#endif    // END MAPLE
                        if (ans[0] == 'y' || ans[0] == 'Y') {
                            sprintf(shortbuf,
                                    "小鸡已经装配上 %s 了",
                                    p[choice].name);
                            temppress(shortbuf);
                            d.attack +=
                                (p[choice].attack -
                                 p[variance].attack);
                            d.resist +=
                                (p[choice].resist -
                                 p[variance].resist);
                            d.speed +=
                                (p[choice].speed -
                                 p[variance].speed);
                            d.money -=
                                (p[choice].cost -
                                 p[variance].sell);
                            variance = choice;
                        } else {
                            sprintf(shortbuf,
                                    "放弃购买.....");
                            temppress(shortbuf);
                        }
                    }
                }
                break;

            case 'S':
            case 's':
                if (variance != 0) {
                    sprintf(shortbuf,
                            "你确定要卖掉%s吗? 卖价:%d [y/N]",
                            p[variance].name, p[variance].sell);
#ifdef MAPLE
                    getdata(b_lines - 1, 1, shortbuf, ans, 2, 1, 0);
#else
                    getdata(b_lines-1,1,shortbuf,ans,2,DOECHO,NULL,true);
#endif    // END MAPLE
                    if (ans[0] == 'y' || ans[0] == 'Y') {
                        sprintf(shortbuf, "装备 %s 卖了 %d",
                                p[variance].name,
                                p[variance].sell);
                        d.attack -= p[variance].attack;
                        d.resist -= p[variance].resist;
                        d.speed -= p[variance].speed;
                        d.money += p[variance].sell;
                        temppress(shortbuf);
                        variance = 0;
                    } else {
                        sprintf(shortbuf,
                                "ccc..我回心转意了...");
                        temppress(shortbuf);
                    }
                } else if (variance == 0) {
                    sprintf(shortbuf, "你本来就没有装备了...");
                    temppress(shortbuf);
                    variance = 0;
                }
                break;

            case 'W':
            case 'w':
                pip_data_list();
                break;

#ifdef MAPLE
            case Ctrl('R'):
                if (currutmp->msgs[0].last_pid) {
                    show_last_call_in();
                    my_write(currutmp->msgs[0].last_pid,
                             "水球丢回去:");
                }
                break;
#endif    // END MAPLE
        }
    } while ((pipkey != 'Q') && (pipkey != 'q') && (pipkey != KEY_LEFT));

    return variance;
}
Ejemplo n.º 11
0
int vice_main() {
    FILE *fb = fopen(VICE_BINGO, "r"), *fd, *fj;
    char buf_data[256]
	, serial[16], ch[2], *ptr;
    int TABLE[] = {0,10,200,1000,4000,10000,40000,100000,200000};
    int total = 0, money, i = 4, j = 0;

    sprintf(buf_data, BBSHOME "/home/%c/%s/%s",
            cuser.userid[0], cuser.userid, VICE_DATA);
    fd = fopen(buf_data, "r");

    if(!fd) {
        ran_showmfile(VICE_NO, MAX_NO_PICTURE);
        return 0;
    }
    clear();
    ran_showfile(0, 0, VICE_PLAY, 1);
    ran_showfile(10, 0, VICE_SHOW, 1);

    getdata(8, 0, "任一鍵:對獎 s:查票 q:離開): ", ch, 2, LCECHO);

    if(ch[0] == 'q' || ch[0] == 'Q'){
	if(fd) fclose(fd);
	return 0;
    }

    if(ch[0] == 's' || ch[0]=='S') {
        j = 0;
        i = 0;
        move(10,22);
        clrtoeol();
        prints("這一期的發票號碼");
        while(fgets(serial, 15, fd)) {
            if((ptr = strchr(serial,'\r')))
                *ptr = 0;
            if(j == 0)
                i++;
            move(10 + i, 20 + j);
            prints("%s", serial);
            j += 9;
            j %= 45;
        }
        getdata(8, 0, "妳要開始對獎了嗎?(或是按q離開)): ", ch, 2, LCECHO);
        if(ch[0] == 'q'){
            if(fd) fclose(fd);
            return 0;
        }
    }

    lockreturn0(VICE, LOCK_MULTI);

    if(!fd) {
        ran_showmfile(VICE_END, MAX_END_PICTURE);
        unlockutmpmode();
        return 0;
    }

    showtitle("發票對獎", BBSName);
    rewind(fd);
    vice_load(fb);
    while(fgets(serial, 15, fd)) {
        if((ptr = strchr(serial,'\n')))
            *ptr = 0;
        money = TABLE[check(serial)];
        total += money;
        prints("%s 中了 %d\n", serial, money);
    }
    pressanykey();
    if(total > 0) {
        if(!(fj = fopen(VICE_JAKPOT, "a")))
            perror("can't open jakpot file");
        ran_showmfile(VICE_WIN, MAX_WIN_PICTURE);
        move(22,0);
        clrtoeol();
        prints("全部的發票中了 %d 塊錢\n", total);
        inmoney(total);
        fprintf(fj, "%-15s 中了$%d\n", cuser.userid, total);
        fclose(fj);
    } else
        ran_showmfile(VICE_LOST, MAX_LOST_PICTURE);

    fclose(fd);

    unlink(buf_data);

    pressanykey();
    unlockutmpmode();
    return 0;
}