?? pip_store.c
字號:
} else { sprintf(inbuf, "放棄買入....."); temppress(inbuf); } break; case 'S': case 's': if (mode == 3) { temppress("這些東西不能賣喔...."); break; } move(b_lines - 1, 1); sprintf(inbuf, "想要賣出啥呢? [0]放棄賣出 [1~%d]物品商號", oldnum[0]);#ifdef MAPLE getdata(b_lines - 1, 1, inbuf, genbuf, 3, LCECHO, "0");#else getdata(b_lines-1,1,inbuf,genbuf,3,DOECHO,NULL,true); if ((genbuf[0] >= 'A') && (genbuf[0] <= 'Z')) genbuf[0] = genbuf[0] | 32;#endif // END MAPLE choice = atoi(genbuf); if (choice >= 1 && choice <= oldnum[0]) { clrchyiuan(6, 18); if (rand() % 2 > 0) show_buy_pic(p[choice].pic1); else show_buy_pic(p[choice].pic2); move(b_lines - 1, 0); clrtoeol(); move(b_lines - 1, 1); smoney = 0; sprintf(inbuf, "你要賣出物品 [%s] 多少個呢?(上限 %d)", p[choice].name, oldnum[choice]);#ifdef MAPLE getdata(b_lines - 1, 1, inbuf, genbuf, 6, 1, 0);#else getdata(b_lines-1,1,inbuf,genbuf,6,DOECHO,NULL,true);#endif // END MAPLE smoney = atoi(genbuf); if (smoney < 0) { temppress("放棄賣出..."); } else if (smoney > oldnum[choice]) { sprintf(inbuf, "你的 [%s] 沒有那麼多個喔", p[choice].name); temppress(inbuf); } else { sprintf(inbuf,"確定賣出物品 [%s] 數量 %ld 個嗎?(店家買價 %ld) [y/N]:", p[choice].name,smoney,smoney*p[choice].money*8/10);#ifdef MAPLE getdata(b_lines - 1, 1, inbuf, genbuf, 2, 1, 0);#else getdata(b_lines-1,1,inbuf,genbuf,2,DOECHO,NULL,true);#endif // END MAPLE if (genbuf[0] == 'y' || genbuf[0] == 'Y') { oldnum[choice] -= smoney; d.money += smoney * p[choice].money * 8 / 10; sprintf(inbuf,"老板拿走了你的%ld個%s",smoney,p[choice].name); temppress(inbuf); } else { temppress("放棄賣出..."); } } } else { sprintf(inbuf, "放棄賣出....."); temppress(inbuf); } break; case 'Q': case 'q': sprintf(inbuf, "金錢交易共 %d 元,離開 %s ", d.money - oldmoney, shopname[mode]); temppress(inbuf); 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 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;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -