⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pip_store.c

📁 one bbs source code
💻 C
📖 第 1 页 / 共 2 页
字号:
						if(mode==3 && choice==2)						{							d.happy+=(rand()%2+2)*smoney;							d.wisdom+=(2+10/(d.wisdom/100+1))*smoney;							d.character+=(rand()%4+2)*smoney;							d.art+=(rand()%2+1)*smoney;						}					}					else					{						pressanykey("放弃买入...");					}				}			}			else			{				sprintf(inbuf,"放弃买入.....");				pressanykey(inbuf);            			}			break;           		case 'S': 		case 's': 			if(mode==3) 			{ 				pressanykey("这些东西不能卖喔...."); 				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,YEA);                        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, YEA);#endif  // END MAPLE				smoney=atoi(genbuf);				if(smoney<0)				{					pressanykey("放弃卖出...");				}				else if(smoney>oldnum[choice])				{					sprintf(inbuf,"你的 [%s] 没有那麽多个喔",p[choice].name);					pressanykey(inbuf);				}				else				{					sprintf(inbuf,"确定卖出物品 [%s] 数量 %d 个吗?(店家买价 %d) [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, YEA);#endif  // END MAPLE					if(genbuf[0]=='y' || genbuf[0]=='Y')					{						oldnum[choice]-=smoney;						d.money+=smoney*p[choice].money*8/10;						sprintf(inbuf,"老板拿走了你的%d个%s",smoney,p[choice].name);						pressanykey(inbuf);					}					else					{						pressanykey("放弃卖出...");					}				}			}			else			{				sprintf(inbuf,"放弃卖出.....");				pressanykey(inbuf);            			}			break;		case 'Q':		case 'q':			sprintf(inbuf,"金钱交易共 %d 元,离开 %s ",d.money-oldmoney,shopname[mode]);			pressanykey(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;}intpip_weapon_doing_menu(variance,type,p)               /* 武器购买画面 */int variance;int type;struct weapon *p;{  time_t now;  register int n=0;  register char *s;  char buf[256];  char ans[5];  char shortbuf[100];  char menutitle[5][11]={"头部装备区","右手装备区","左手装备区","身体装备区","足部装备区"};    int pipkey;  char choicekey[5];  int choice;    do{   clear();   showtitle(menutitle[type], BoardName);   show_weapon_pic(0);/*   move(10,2);    sprintf(buf,"现今能力:体力Max:%-5d  法力Max:%-5d  攻击:%-5d  防御:%-5d  速度:%-5d ",           d.maxhp,d.maxmp,d.attack,d.resist,d.speed);   prints(buf);*/   move(11,2);   sprintf(buf," [NO]  [器具名]  [体力]  [法力]  [速度]  [攻击]  [防御]  [速度]  [售  价] ");   prints(buf);   move(12,2);   sprintf(buf," ——白色 可以购买——绿色 拥有装备——黄色 钱钱不够——紫色 能力不足——");   prints(buf);    n=0;   while (s = p[n].name)   {        move(13+n,2);     if(variance!=0 && variance==(n))/*本身有的*/     {      sprintf(buf,       " (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d",           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,       " (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d",      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,       " (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d",           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,       " (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d",           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,"  武器购买选单    [B]购买武器  [S]卖掉装备  [W]个人资料  [Q]跳出:            ");   prints(buf);      now=time(0);   pip_time_change(now);   pipkey=egetch();   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,YEA);     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,"放弃购买...");          pressanykey(shortbuf);       }             else if(variance==choice)  /*早已经有啦*/       {          sprintf(shortbuf,"你早已经有 %s 罗",p[variance].name);          pressanykey(shortbuf);             }             else if(p[choice].cost >= (d.money+p[variance].sell))  /*钱不够*/       {          sprintf(shortbuf,"这个要 %d 元,你的钱不够啦!",p[choice].cost);          pressanykey(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);          pressanykey(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, YEA);#endif  // END MAPLE          if(ans[0]=='y' || ans[0]=='Y')          {              sprintf(shortbuf,"小鸡已经装配上 %s 了",p[choice].name);              pressanykey(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,"放弃购买.....");              pressanykey(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, YEA);#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;           pressanykey(shortbuf);           variance=0;        }        else        {           sprintf(shortbuf,"ccc..我回心转意了...");           pressanykey(shortbuf);                 }     }     else if(variance==0)     {        sprintf(shortbuf,"你本来就没有装备了...");        pressanykey(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 + -