void ConsumerCheckout::on_addButton_clicked() { if(ischeck){ receiptinit(); //checkout = new Checkout(); ischeck = 0; } QString barcode = ui->barcodelineEdit->text(); double count = ui->countlineEdit->text().toDouble(); if(!checkout->add(barcode,count)){ QMessageBox::warning(this, tr("ADD Waring"), tr("Barcode not correct!"), QMessageBox::Yes); return; } std::vector<Item>::iterator p = finditem(barcode,itemlist); std::vector<Item>::iterator q = finditem(barcode,checkout->getSale()); if(q->amount > p->amount){ QMessageBox::warning(this, tr("ADD Waring"), tr("Not enough!"), QMessageBox::Yes); checkout->add(barcode,-count); return; } int row = ui->tableWidget->rowCount(); if(q->amount!=count){ for(int i=0;i<row;i++){ if(ui->tableWidget->item(i,1)->text()==barcode){ ui->tableWidget->item(i,3)->setText(QString::number(q->amount,'g',6)); ui->tableWidget->item(i,4)->setText(QString::number(q->price*q->amount,'g',6)); break; } } } else{ ui->tableWidget->insertRow(row); ui->tableWidget->setItem(row,0,new QTableWidgetItem(q->name)); ui->tableWidget->setItem(row,1,new QTableWidgetItem(q->barcode)); ui->tableWidget->setItem(row,2,new QTableWidgetItem(QString::number(q->price,'g',6))); ui->tableWidget->setItem(row,3,new QTableWidgetItem(QString::number(q->amount,'g',6))); ui->tableWidget->setItem(row,4,new QTableWidgetItem(QString::number(q->price*q->amount,'g',6))); } for(int j=0;j<5;j++){ ui->tableWidget->resizeColumnToContents (j); } ui->amountBrowser->setText(QString::number(checkout->_revenue(),'g',6)); ui->barcodelineEdit->clear(); ui->countlineEdit->clear(); }
void InfoManage::on_newButton_clicked() { Item *item = new Item(); item->name = ui->namelineEdit->text(); item->type = ui->typelineEdit->text(); item->barcode = ui->barcodelineEdit->text(); item->price = ui->pricelineEdit->text().toDouble(); item->measurement = ui->measurelineEdit->text(); item->cost = ui->costlineEdit->text().toDouble(); item->amount = ui->countlineEdit->text().toDouble(); item->comment = ui->commentlineEdit->text(); if(item->comment.isEmpty()) item->comment = "none"; if(!correctBarcode(item->barcode)){ QMessageBox::warning(this, tr("NEW Warning"), tr("barcode not correct!") ); return; } if(finditem(item->barcode,itemlist)!=itemlist.end()){ QMessageBox::warning(this, tr("NEW Warning"), tr("already existed!") ); return; } ui->tableWidget->insertRow(itemlist.size()); itemlist.push_back(*item); showitem(itemlist); }
void InfoManage::on_deleteButton_clicked() { int i = ui->tableWidget->currentRow(); QString barcode = ui->tableWidget->item(i,2)->text(); itemlist.erase(finditem(barcode,itemlist)); ui->tableWidget->removeRow(i); }
void InfoManage::on_tableWidget_itemChanged(QTableWidgetItem *item) { if(!clicked) return; clicked = 0; if(item->column()==2){ QString barcode = item->text(); if(!correctBarcode(barcode)){ QMessageBox::warning(this, tr("EDIT Warning"), tr("barcode not correct!") ); item->setText(tablewidgetitem.text()); return; } else{ std::vector<Item>::iterator p = finditem(tablewidgetitem.text(),itemlist); if(p==itemlist.end()) return; p->barcode = barcode; } } else{ QString barcode = ui->tableWidget->item(item->row(),2)->text(); std::vector<Item>::iterator p = finditem(barcode,itemlist); if(p==itemlist.end()) return; switch(item->column()){ case 0: p->name = item->text();break; case 1: p->type = item->text();break; case 3: p->price = item->text().toDouble();break; case 4: p->measurement = item->text();break; case 5: p->cost = item->text().toDouble();break; case 6: p->amount = item->text().toDouble();break; case 7: if(item->text().isEmpty()) item->setText("none"); else p->comment = item->text();break; default: break; } } }
void InfoManage::on_searchButton_clicked() { QString name = ui->namelineEdit->text(); QString type = ui->typelineEdit->text(); QString barcode = ui->barcodelineEdit->text(); std::vector<Item> ilist; if(!barcode.isEmpty()){ if(finditem(barcode,ilist)==ilist.end()){ QMessageBox::warning(this, tr("Application"),tr("Incorrect Barcode!"));//deal with the error when finding fails return; } ilist.push_back(*finditem(barcode,itemlist)); } else{ if(!name.isEmpty()){ std::vector<Item>::iterator p; for(p=itemlist.begin();p<itemlist.end();p++){ if(p->name==name){ if(!type.isEmpty()){ if(p->type==type) ilist.push_back(*p); } else ilist.push_back(*p); } } } else{ std::vector<Item>::iterator p; for(p=itemlist.begin();p<itemlist.end();p++){ if(p->type==type){ ilist.push_back(*p); } } } } showitem(ilist); }
void MessageWind::contact_offline(const QString &number)//联系人离线 { Contact *contact=indexofcontact(number,NULL,NULL); if(contact!=NULL) //只标示联系人离线 { contact->onLine=false; QTreeWidgetItem *item=finditem(number); for(int i=0;i<childBlinkItems.count();i++)//闪烁时,设置为离线时的图标 { if(childBlinkItems[i]->getitem()==item) childBlinkItems[i]->setofflineicon(); } item->setIcon(0,QIcon(":/icon/icons/user_offline.png")); return; } }
void MessageWind::init() { QTextCodec::setCodecForTr(QTextCodec::codecForName("gb2312")); ui->contactsTreeWidget->setHeaderLabel(tr("联系人")); QTreeWidgetItem *whitecontacts=new QTreeWidgetItem(); whitecontacts->setText(0,tr("我的好友")); //QTreeWidgetItem *unknowncontacts=new QTreeWidgetItem(QStringList()<<"陌生人"); // QTreeWidgetItem *darkcontacts=new QTreeWidgetItem(QStringList()<<"黑名单"); QTreeWidgetItem *unknowncontacts=new QTreeWidgetItem(); unknowncontacts->setText(0,tr("陌生人")); QTreeWidgetItem *darkcontacts=new QTreeWidgetItem(); darkcontacts->setText(0,tr("黑名单")); ui->contactsTreeWidget->addTopLevelItem(whitecontacts); whitecontacts->setExpanded(true); //将白名单设置为展开 ui->contactsTreeWidget->addTopLevelItem(unknowncontacts); ui->contactsTreeWidget->addTopLevelItem(darkcontacts); whitecontacts->setWhatsThis(0,QString::number(0)); //将白名单的子闪烁集合设置为0 parentBlinkItems.append(new ParentBlink(whitecontacts)); unknowncontacts->setWhatsThis(0,QString::number(0));//将未知联系人的子闪烁集合设置为0 parentBlinkItems.append(new ParentBlink(unknowncontacts)); darkcontacts->setWhatsThis(0,QString::number(0)); //将黑名单的子闪烁集合设置为0 parentBlinkItems.append(new ParentBlink(darkcontacts)); for(int i=0;i<allContacts.count();i++) { QTreeWidgetItem *child=new QTreeWidgetItem(QStringList()<<(allContacts[i].name+":"+allContacts[i].number)); //显示联系人信息 child->setWhatsThis(0,allContacts[i].name+":"+allContacts[i].number);//因为闪烁的时候文本会改变,所以将联系人的信息保存在whatsthis 中 child->setIcon(0,QIcon(":/icon/icons/user_offline.png")); //初始化时设置为离线 if(allContacts[i].isWhite) ui->contactsTreeWidget->topLevelItem(0)->addChild(child); //白名单添加到白名单中 else ui->contactsTreeWidget->topLevelItem(2)->addChild(child); //黑名单添加到黑名单中 } for(int i=0;i<unreadsms.count();i++) //若短信文件中有未读短信,则对应的联系人闪烁 { QTreeWidgetItem *item=finditem(unreadsms[i].number); if(item!=NULL) //存在联系人 addchildblink(item); } ui->receiveBoxButton->setToolTip(tr("收件箱")); //设置对应按钮的提示 ui->writeButton->setToolTip(tr("写信息")); ui->sendBoxButton->setToolTip(tr("发件箱")); ui->draftBoxButton->setToolTip(tr("草稿箱")); ui->settingButton->setToolTip(tr("设置")); informer.start();//通知所有联系人,我已上线 }
void ConsumerCheckout::on_checkoutButton_clicked() { QDateTime date = QDateTime::currentDateTime(); double revenue = checkout->check(date); //double revenue = 10; double collect = ui->collectlineEdit->text().toDouble(); double change = collect - revenue; ui->changeBrowser->setText(QString::number(change,'g',6)); //Checkout onecheck = *checkout; //e.push_back(onecheck); salelist.push_back(*checkout); QFile file("salerecord.txt"); if (!file.open(QFile::WriteOnly | QFile::Text | QIODevice::Append)) { QMessageBox::warning(this, tr("Application"),tr("Cannot write file salerecord")); } QTextStream out(&file); std::vector<Item>::iterator p; std::vector<Item>::iterator q; for(p=checkout->getSale().begin();p<checkout->getSale().end();p++){ out<< date.toString("yyyy-MM-dd")<< " "<<p->name<<" "<<p->type<<" "<< QString::number((p->price - p->cost)*p->amount,'g',6)<<"\n"; q = finditem(p->barcode,itemlist); q->amount = q->amount - p->amount; } int row = ui->tableWidget->rowCount(); ui->tableWidget->insertRow(row); ui->tableWidget->setItem(row,3,new QTableWidgetItem("total:")); ui->tableWidget->setItem(row,4,new QTableWidgetItem(QString::number(checkout->getRevenue(),'g',6))); row = ui->tableWidget->rowCount(); ui->tableWidget->insertRow(row); ui->tableWidget->setItem(row,3,new QTableWidgetItem("date:")); QString d = checkout->getDate().toString("yyyy-MM-dd"); ui->tableWidget->setItem(row,4,new QTableWidgetItem(d)); for(int j=0;j<5;j++){ ui->tableWidget->resizeColumnToContents (j); } renew(); ischeck = 1; }
void InfoManage::on_addButton_clicked() { QString barcode = ui->barcodelineEdit->text(); double count = ui->countlineEdit->text().toDouble(); if(!correctBarcode(barcode)){ QMessageBox::warning(this, tr("ADD Warning"), tr("barcode not correct!") ); return; } std::vector<Item>::iterator p = finditem(barcode,itemlist); if(p==itemlist.end()){ QMessageBox::warning(this, tr("ADD Warning"), tr("not found!") ); return; } p->amount += count; showitem(itemlist); }
void MessageWind::contact_online(const QString &number,bool reply)//联系人上线 { QTcpSocket socket; socket.connectToHost(number,1573); Contact *contact=indexofcontact(number,NULL,NULL); if(contact!=NULL)//已经存在的联系人,发回响应消息,并且标示联系人在线 { if(reply) //如果收到的是+++,则发回响应消息,如果收到的是+-+,则不发回响应消息 { sendmessage(number,"+-+"); } for(int i=0;i<allMessages.count();i++)//查看是否存在对方的离线消息 { if(allMessages[i].number==number&&allMessages[i].from==4) { sendmessage(number,"###"+allMessages[i].content); //发送离线消息 allMessages[i].from=0; //将信息从草稿箱转移到发件箱 allMessages[i].now=0; } } contact->onLine=true; //设置为在线 QTreeWidgetItem *item=finditem(number); for(int i=0;i<childBlinkItems.count();i++)//闪烁时,设置为在线时的图标 { if(childBlinkItems[i]->getitem()==item) childBlinkItems[i]->setonlineicon(); } item->setIcon(0,QIcon(":/icon/icons/user.png")); return; } else//未知联系人,只发回响应消息 { if(reply) sendmessage(number,"+-+"); } }
/* *************** LOOK_FOR_OBJECT *************** subroutine to look for an object and give the player his options if an object was found. */ lookforobject() { register int i,j; if (c[TIMESTOP]) return; /* can't find objects is time is stopped */ i=item[playerx][playery]; if (i==0) return; showcell(playerx,playery); cursors(); yrepcount=0; switch(i) { case OGOLDPILE: case OMAXGOLD: case OKGOLD: case ODGOLD: lprcat("\n\nYou have found some gold!"); ogold(i); break; case OPOTION: lprcat("\n\nYou have found a magic potion"); i = iarg[playerx][playery]; if (potionname[i][0]) lprintf(" of %s",&potionname[i][1]); opotion(i); break; case OSCROLL: lprcat("\n\nYou have found a magic scroll"); i = iarg[playerx][playery]; if (scrollname[i][0]) lprintf(" of %s",&scrollname[i][1]); oscroll(i); break; case OALTAR: if (nearbymonst()) return; lprcat("\n\nThere is a Holy Altar here!"); oaltar(); break; case OBOOK: lprcat("\n\nYou have found a book."); obook(); break; case OCOOKIE: lprcat("\n\nYou have found a fortune cookie."); ocookie(); break; case OTHRONE: if (nearbymonst()) return; lprintf("\n\nThere is %s here!",objectname[i]); othrone(0); break; case OTHRONE2: if (nearbymonst()) return; lprintf("\n\nThere is %s here!",objectname[i]); othrone(1); break; case ODEADTHRONE: lprintf("\n\nThere is %s here!",objectname[i]); odeadthrone(); break; case OORB: lprcat("\n\nYou have found the Orb!!!!!"); oorb(); break; case OPIT: lprcat("\n\nYou're standing at the top of a pit."); opit(); break; case OSTAIRSUP: lprcat("\n\nThere is a circular staircase here"); ostairs(1); /* up */ break; case OELEVATORUP: lprcat("\n\nYou feel heavy for a moment, but the feeling disappears"); oelevator(1); /* up */ break; case OFOUNTAIN: if (nearbymonst()) return; lprcat("\n\nThere is a fountain here"); ofountain(); break; case OSTATUE: if (nearbymonst()) return; lprcat("\n\nYou are standing in front of a statue"); ostatue(); break; case OCHEST: lprcat("\n\nThere is a chest here"); ochest(); break; case OIVTELETRAP: if (rnd(11)<6) return; item[playerx][playery] = OTELEPORTER; know[playerx][playery] = 1; case OTELEPORTER: lprcat("\nZaaaappp! You've been teleported!\n"); beep(); nap(3000); oteleport(0); break; case OSCHOOL: if (nearbymonst()) return; lprcat("\n\nYou have found the College of Larn."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') { oschool(); /* the college of larn */ } else lprcat(" stay here"); break; case OMIRROR: if (nearbymonst()) return; lprcat("\n\nThere is a mirror here"); omirror(); break; case OBANK2: case OBANK: if (nearbymonst()) return; if (i==OBANK) lprcat("\n\nYou have found the bank of Larn."); else lprcat("\n\nYou have found a branch office of the bank of Larn."); lprcat("\nDo you (g) go inside, or (i) stay here? "); j=0; while ((j!='g') && (j!='i') && (j!='\33')) j=getchar(); if (j == 'g') { if (i==OBANK) obank(); else obank2(); /* the bank of larn */ } else lprcat(" stay here"); break; case ODEADFOUNTAIN: if (nearbymonst()) return; lprcat("\n\nThere is a dead fountain here"); break; case ODNDSTORE: if (nearbymonst()) return; lprcat("\n\nThere is a DND store here."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') dndstore(); /* the dnd adventurers store */ else lprcat(" stay here"); break; case OSTAIRSDOWN: lprcat("\n\nThere is a circular staircase here"); ostairs(-1); /* down */ break; case OELEVATORDOWN: lprcat("\n\nYou feel light for a moment, but the feeling disappears"); oelevator(-1); /* down */ break; case OOPENDOOR: lprintf("\n\nYou have found %s",objectname[i]); lprcat("\nDo you (c) close it"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar(); if ((i=='\33') || (i=='i')) { ignore(); break; } lprcat("close"); forget(); item[playerx][playery]=OCLOSEDDOOR; iarg[playerx][playery]=0; playerx = lastpx; playery = lastpy; break; case OCLOSEDDOOR: lprintf("\n\nYou have found %s",objectname[i]); lprcat("\nDo you (o) try to open it"); iopts(); i=0; while ((i!='o') && (i!='i') && (i!='\33')) i=getchar(); if ((i=='\33') || (i=='i')) { ignore(); playerx = lastpx; playery = lastpy; break; } else { lprcat("open"); if (rnd(11)<7) { switch(iarg[playerx][playery]) { case 6: c[AGGRAVATE] += rnd(400); break; case 7: lprcat("\nYou are jolted by an electric shock "); lastnum=274; losehp(rnd(20)); bottomline(); break; case 8: loselevel(); break; case 9: lprcat("\nYou suddenly feel weaker "); if (c[STRENGTH]>3) c[STRENGTH]--; bottomline(); break; default: break; } playerx = lastpx; playery = lastpy; } else { forget(); item[playerx][playery]=OOPENDOOR; } } break; case OENTRANCE: lprcat("\nYou have found "); lprcat(objectname[OENTRANCE]); lprcat("\nDo you (g) go inside"); iopts(); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') { newcavelevel(1); playerx=33; playery=MAXY-2; item[33][MAXY-1]=know[33][MAXY-1]=mitem[33][MAXY-1]=0; draws(0,MAXX,0,MAXY); bot_linex(); return; } else ignore(); break; case OVOLDOWN: lprcat("\nYou have found "); lprcat(objectname[OVOLDOWN]); lprcat("\nDo you (c) climb down"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar(); if ((i=='\33') || (i=='i')) { ignore(); break; } if (level!=0) { lprcat("\nThe shaft only extends 5 feet downward!"); return; } if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep(); lastnum=275; losehp(30+rnd(20)); bottomhp(); } else lprcat("climb down"); nap(3000); newcavelevel(MAXLEVEL); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */ if (item[j][i]==OVOLUP) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); } draws(0,MAXX,0,MAXY); bot_linex(); return; case OVOLUP: lprcat("\nYou have found "); lprcat(objectname[OVOLUP]); lprcat("\nDo you (c) climb up"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar(); if ((i=='\33') || (i=='i')) { ignore(); break; } if (level!=11) { lprcat("\nThe shaft only extends 8 feet upwards before you find a blockage!"); return; } if (packweight() > 45+5*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep(); lastnum=275; losehp(15+rnd(20)); bottomhp(); return; } lprcat("climb up"); lflush(); nap(3000); newcavelevel(0); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */ if (item[j][i]==OVOLDOWN) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); } draws(0,MAXX,0,MAXY); bot_linex(); return; case OTRAPARROWIV: if (rnd(17)<13) return; /* for an arrow trap */ item[playerx][playery] = OTRAPARROW; know[playerx][playery] = 0; case OTRAPARROW: lprcat("\nYou are hit by an arrow"); beep(); /* for an arrow trap */ lastnum=259; losehp(rnd(10)+level); bottomhp(); return; case OIVDARTRAP: if (rnd(17)<13) return; /* for a dart trap */ item[playerx][playery] = ODARTRAP; know[playerx][playery] = 0; case ODARTRAP: lprcat("\nYou are hit by a dart"); beep(); /* for a dart trap */ lastnum=260; losehp(rnd(5)); if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3; bottomline(); return; case OIVTRAPDOOR: if (rnd(17)<13) return; /* for a trap door */ item[playerx][playery] = OTRAPDOOR; know[playerx][playery] = 1; case OTRAPDOOR: lastnum = 272; /* a trap door */ if ((level==MAXLEVEL-1) || (level==MAXLEVEL+MAXVLEVEL-1)) { lprcat("\nYou fell through a bottomless trap door!"); beep(); nap(3000); died(271); } lprcat("\nYou fall through a trap door!"); beep(); /* for a trap door */ losehp(rnd(5+level)); nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY); bot_linex(); return; case OTRADEPOST: if (nearbymonst()) return; lprcat("\nYou have found the Larn trading Post."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') otradepost(); else lprcat("stay here"); return; case OHOME: if (nearbymonst()) return; lprcat("\nYou have found your way home."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') ohome(); else lprcat("stay here"); return; case OWALL: break; case OANNIHILATION: died(283); return; /* annihilated by sphere of annihilation */ case OLRS: if (nearbymonst()) return; lprcat("\n\nThere is an LRS office here."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') olrs(); /* the larn revenue service */ else lprcat(" stay here"); break; default: finditem(i); break; }; }
/* *************** LOOK_FOR_OBJECT *************** subroutine to look for an object and give the player his options if an object was found. */ lookforobject() { int i,j; /* can't find objects is time is stopped*/ if (c[TIMESTOP]) return; i=item[playerx][playery]; if (i==0) return; showcell(playerx,playery); cursors(); yrepcount=0; switch(i) { case OGOLDPILE: case OMAXGOLD: case OKGOLD: case ODGOLD: ogold(i); break; case OPOTION: lprcat("\n\nYou find a magic potion"); i = iarg[playerx][playery]; if (potionknown[i]) lprintf(" of %s",&potionname[i][1]); lprcat("."); opotion(i); break; case OSCROLL: lprcat("\n\nYou find a magic scroll"); i = iarg[playerx][playery]; if (scrollknown[i]) lprintf(" of %s",&scrollname[i][1]); lprcat("."); oscroll(i); break; case OALTAR: if (nearbymonst()) return; lprcat("\n\nThere is a holy altar here."); oaltar(); break; case OBOOK: lprcat("\n\nYou find a book."); obook(); break; case OCOOKIE: lprcat("\n\nYou find a fortune cookie."); ocookie(); break; case OTHRONE: if (nearbymonst()) return; lprintf("\n\nThere is %s here.",objectname[i]); othrone(0); break; case OTHRONE2: if (nearbymonst()) return; lprintf("\n\nThere is %s here.",objectname[i]); othrone(1); break; case ODEADTHRONE: lprintf("\n\nThere is %s here.",objectname[i]); odeadthrone(); break; case OORB: if (nearbymonst()) return; finditem(i); break; case OBRASSLAMP: lprcat("\nYou find a brass lamp."); lprcat("\nDo you want to (r) rub it, (t) take it, or (i) ignore it? "); i=0; while ((i!='r') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='r') { i=rnd(100); if (i>90) { lprcat("\nThe magic genie was very upset at being disturbed!"); lastnum = 286; losehp((int)c[HP]/2+1); beep(); } /* higher level, better chance of spell */ else if ( (rnd(100)+c[LEVEL]/2) > 80) { int a,b,d; lprcat("\nA magic genie appears!"); cursors(); lprcat("\n What spell would you like? : "); while ((a=getcharacter())=='D') { seemagic(99); cursors(); lprcat("\n What spell would you like? : "); } /* to escape casting a spell */ if (a==ESC) goto over; if ((b=getcharacter())==ESC) goto over; if ((d=getcharacter())==ESC) { over: lprcat("aborted"); return; } lprc('\n'); for (i=0; i<SPNUM; i++) if ((spelcode[i][0]==a) && (spelcode[i][1]==b) && (spelcode[i][2]==d)) { spelknow[i]=1; lprintf("\nSpell \"%s\": %s\n%s",spelcode[i], spelname[i],speldescript[i]); lprcat("\nThe genie prefers not to be disturbed " "again."); forget(); bottomline(); return; } lprcat("\nThe genie has never heard of such a spell!"); lprcat("\nThe genie prefers not to be disturbed again."); forget(); bottomline(); return; } else lprcat("\nnothing happened."); if (rnd(100) < 15) { lprcat("\nThe genie prefers not to be disturbed again!"); forget(); c[LAMP]=0; /* chance of finding lamp again */ } bottomline(); } else if (i=='t') { lprcat("take."); if (take(OBRASSLAMP,0)==0) forget(); } else lprcat("ignore."); return; case OWWAND: if (nearbymonst()) return; finditem(i); break; case OHANDofFEAR: if (nearbymonst()) return; finditem(i); break; case OPIT: lprcat("\n\nYou're standing at the top of a pit."); opit(); break; case OSTAIRSUP: lprcat("\n\nThere is a circular staircase here."); ostairs(1); /* up */ break; case OELEVATORUP: lprcat("\n\nYou have found an express elevator going up."); oelevator(1); /* up */ break; case OELEVATORDOWN: lprcat("\n\nYou have found an express elevator going down."); oelevator(-1); /* down */ break; case OFOUNTAIN: if (nearbymonst()) return; lprcat("\n\nThere is a fountain here."); ofountain(); break; case OSTATUE: if (nearbymonst()) return; lprcat("\n\nYou stand before a statue."); ostatue(); break; case OCHEST: lprcat("\n\nThere is a chest here."); ochest(); break; case OIVTELETRAP: if (rnd(11)<6) return; item[playerx][playery] = OTELEPORTER; know[playerx][playery] = 1; case OTELEPORTER: lprcat("\nZaaaappp! You've been teleported!\n"); beep(); nap(3000); oteleport(0); break; case OSCHOOL: if (nearbymonst()) return; lprcat("\n\nYou have found the College of Ularn."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') { oschool(); /* the college of larn */ } else lprcat(" stay here."); break; case OMIRROR: if (nearbymonst()) return; lprcat("\n\nThere is a mirror here."); omirror(); break; case OBANK2: case OBANK: if (nearbymonst()) return; if (i==OBANK) lprcat("\n\nYou have found the bank of Ularn."); else lprcat("\n\nYou have found a branch office of the bank of Ularn."); lprcat("\nDo you (g) go inside, or (i) stay here? "); j=0; while ((j!='g') && (j!='i') && (j!=ESC)) j=getcharacter(); if (j == 'g') { if (i==OBANK) obank(); else obank2(); /* the bank of larn */ } else lprcat(" stay here."); break; case ODEADFOUNTAIN: if (nearbymonst()) return; lprcat("\n\nThere is a dead fountain here."); break; case ODNDSTORE: if (nearbymonst()) return; lprcat("\n\nThere is a DND store here."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') dndstore(); /* the dnd adventurers store */ else lprcat(" stay here."); break; case OSTAIRSDOWN: lprcat("\n\nThere is a circular staircase here."); ostairs(-1); /* down */ break; case OOPENDOOR: lprcat("\nThere is an open door here."); break; case OCLOSEDDOOR: if (dropflag) return; lprintf("\n\nYou find %s",objectname[i]); lprcat("\nDo you (o) try to open it"); iopts(); i=0; while ((i!='o') && (i!='i') && (i!=ESC)) i=getcharacter(); if ((i==ESC) || (i=='i')) { ignore(); playerx = lastpx; playery = lastpy; break; } else { lprcat("open."); if (rnd(11)<7) { switch(iarg[playerx][playery]) { case 6: c[AGGRAVATE] += rnd(400); break; case 7: case 8: lprcat("\nYou are jolted by an electric shock!"); lastnum=274; losehp(rnd(20)); bottomline(); break; /* Losing a level is just too harsh... */ /* case 8: loselevel(); break; */ case 9: lprcat("\nYou suddenly feel weaker!"); if (c[STRENGTH]>3) c[STRENGTH]--; bottomline(); break; default: break; } playerx = lastpx; playery = lastpy; } else { forget(); item[playerx][playery]=OOPENDOOR; } } break; case OENTRANCE: lprcat("\nYou have found "); lprcat(objectname[OENTRANCE]); lprcat("\nDo you (g) go inside"); iopts(); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') { newcavelevel(1); playerx=33; playery=MAXY-2; item[33][MAXY-1]=know[33][MAXY-1]=mitem[33][MAXY-1].mon=0; draws(0,MAXX,0,MAXY); bot_linex(); return; } else ignore(); break; case OVOLDOWN: lprcat("\nYou have found "); lprcat(objectname[OVOLDOWN]); lprcat("\nDo you (c) climb down"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!=ESC)) i=getcharacter(); if ((i==ESC) || (i=='i')) { ignore(); break; } if (level!=0) { lprcat("\nThe shaft only extends 5 feet downward!"); return; } if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft."); beep(); lastnum=275; losehp(30+rnd(20)); bottomhp(); } else lprcat("climb down."); nap(3000); newcavelevel(DBOTTOM+1); /* down to V1 */ playerx = rnd(MAXX-2); playery = rnd(MAXY-2); positionplayer(); draws(0,MAXX,0,MAXY); bot_linex(); return; case OVOLUP: lprcat("\nYou have found "); lprcat(objectname[OVOLUP]); lprcat("\nDo you (c) climb up"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!=ESC)) i=getcharacter(); if ((i==ESC) || (i=='i')) { ignore(); break; } if (packweight() > 40+5*(c[DEXTERITY]+c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft."); beep(); lastnum=275; losehp(15+rnd(20)); bottomhp(); return; } lprcat("climb up."); lflush(); nap(3000); newcavelevel(0); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */ if (item[j][i]==OVOLDOWN) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); } draws(0,MAXX,0,MAXY); bot_linex(); return; case OTRAPARROWIV: if (rnd(17)<13) return; /* for an arrow trap */ item[playerx][playery] = OTRAPARROW; know[playerx][playery] = 0; case OTRAPARROW: lprcat("\nYou are hit by an arrow!"); beep(); /* for an arrow trap */ lastnum=259; losehp(rnd(10)+level); bottomhp(); return; case OIVDARTRAP: if (rnd(17)<13) return; /* for a dart trap */ item[playerx][playery] = ODARTRAP; know[playerx][playery] = 0; case ODARTRAP: lprcat("\nYou are hit by a dart!"); beep(); /* for a dart trap */ lastnum=260; losehp(rnd(5)); if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3; bottomline(); return; case OIVTRAPDOOR: if (rnd(17)<13) return; /* for a trap door */ item[playerx][playery] = OTRAPDOOR; know[playerx][playery] = 1; case OTRAPDOOR: lastnum = 272; /* a trap door */ for (i=0;i<IVENSIZE;i++) if (iven[i]==OWWAND) { lprcat("\nYou escape a trap door."); return; } if ((level==DBOTTOM)||(level==VBOTTOM)) { lprcat("\nYou fall through a trap door leading straight to HELL!"); beep(); lflush(); nap(3000); died(271); } lprcat("\nYou fall through a trap door!"); beep(); lflush(); losehp(rnd(5+level)); nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY); bot_linex(); return; case OTRADEPOST: if (nearbymonst()) return; lprcat("\nYou have found the Ularn trading Post."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') otradepost(); else lprcat("stay here."); return; case OHOME: if (nearbymonst()) return; lprcat("\nYou have found your way home."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') ohome(); else lprcat("stay here."); return; case OPAD: if (nearbymonst()) return; lprcat("\nYou have found Dealer McDope's Hideout!"); lprcat("\nDo you (c) check it out, or (i) ignore it? "); i=0; while ((i!='c') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'c') opad(); else lprcat("forget it."); return; case OSPEED: lprcat("\nYou find some speed."); lprcat("\nDo you (s) snort it, (t) take it, or (i) ignore it? "); i=0; while ((i!='s') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='s') { lprcat("snort!"); lprcat("\nOhwowmanlikethingstotallyseemtoslowdown!"); c[HASTESELF] += 200 + c[LEVEL]; c[HALFDAM] += 300 + rnd(200); if ((c[INTELLIGENCE]-=2) < 3) c[INTELLIGENCE]=3; if ((c[WISDOM]-=2) < 3) c[WISDOM]=3; if ((c[CONSTITUTION]-=2) <3) c[CONSTITUTION]=3; if ((c[DEXTERITY]-=2) <3) c[DEXTERITY]=3; if ((c[STRENGTH]-=2) <3) c[STRENGTH]=3; forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OSPEED,0)==0) forget(); } else lprcat("ignore."); break; case OSHROOMS: lprcat("\nYou find some magic mushrooms."); lprcat("\nDo you (e) eat them, (t) take them, or (i) ignore them? "); i=0; while ((i!='e') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='e') { lprcat("eat!"); lprcat("\nThings start to get real spacey..."); c[HASTEMONST] += rnd(75) + 25; c[CONFUSE] += 30+rnd(10); c[WISDOM]+=2; c[CHARISMA]+=2; forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OSHROOMS,0)==0) forget(); } else lprcat("ignore."); break; case OACID: lprcat("\nYou find some LSD."); lprcat("\nDo you (e) eat it, (t) take it, or (i) ignore it? "); i=0; while ((i!='e') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='e') { lprcat("eat!"); lprcat("\nYou are now frying your ass off!"); c[CONFUSE]+=30+rnd(10); c[WISDOM]+=2; c[INTELLIGENCE]+=2; c[AWARENESS]+=1500; c[AGGRAVATE]+=1500; { int j,k; /* heal monsters */ for(j=0;j<MAXY;j++) for(k=0;k<MAXX;k++) if (mitem[k][j].mon) hitp[k][j]=monster[mitem[k][j].mon].hitpoints; } forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OACID,0)==0) forget(); } else lprcat("ignore."); break; case OHASH: lprcat("\nYou find some hashish."); lprcat("\nDo you (s) smoke it, (t) take it, or (i) ignore it? "); i=0; while ((i!='s') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='s') { lprcat("smoke!"); lprcat("\nWOW! You feel stooooooned..."); c[HASTEMONST]+=rnd(75)+25; c[INTELLIGENCE]+=2; c[WISDOM]+=2; if( (c[CONSTITUTION]-=2) < 3) c[CONSTITUTION]=3; if( (c[DEXTERITY]-=2) < 3) c[DEXTERITY]=3; c[HALFDAM]+=300+rnd(200); c[CLUMSINESS]+=rnd(1800)+200; forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OHASH,0)==0) forget(); } else lprcat("ignore."); break; case OCOKE: lprcat("\nYou find some cocaine."); lprcat("\nDo you want to (s) snort it, (t) take it, or (i) ignore it? "); i=0; while ((i!='s') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='s') { lprcat("snort!"); lprcat("\nYour nose begins to bleed!"); if ((c[DEXTERITY]-=2) <3) c[DEXTERITY]=3; if ((c[CONSTITUTION]-=2) <3) c[CONSTITUTION]=3; c[CHARISMA]+=3; for(i=0;i<6;i++) c[i]+=33; c[COKED]+=10; forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OCOKE,0)==0) forget(); } else lprcat("ignore."); break; case OWALL: break; case OANNIHILATION: for (i=0;i<IVENSIZE;i++) if (iven[i]==OSPHTALISMAN) { lprcat("\nThe Talisman of the Sphere protects you from " "annihilation!"); return; } /* annihilated by sphere of annihilation */ died(283); return; case OLRS: if (nearbymonst()) return; lprcat("\n\nThere is an LRS office here."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') olrs(); /* the larn revenue service */ else lprcat(" stay here."); break; default: finditem(i); break; }; }
int getitem(void) { return finditem(getstr()); }
void MessageWind::insertSms(Message newsms) //将消息保存到合适的短信集合 { if(newsms.content=="+++"||newsms.content=="---"||newsms.content=="+-+")//若为上线或者下线的消息 { if(newsms.content=="+++") //对方发来对方的上线消息 { contact_online(newsms.number,true);//标示对方上线,并且回发响应信息和对方的离线消息 Chat *chat; if(chatdialogexist(*(indexofcontact(newsms.number)),&chat)) chat->contatonline();//存在对应联系人的聊天窗口,则重建到对应联系人的连接 } else if(newsms.content=="---") //离线消息,标志对方离线 contact_offline(newsms.number); else//收到+-+ //收到对方发送的我上线的响应消息,则只需要将对方标记为上线,并发送对方的离线消息 { contact_online(newsms.number,false); } return; } //若消息为正常消息 newsms.content=newsms.content.mid(3,newsms.content.length()-3);//去除消息的头部 if(hasBadWords(newsms.content)) //还有敏感词汇,直接扔进垃圾箱 { newsms.from=3;//设置为未读 newsms.now=2; allMessages.prepend(newsms); update(); return; } else { QTreeWidgetItem *item=finditem(newsms.number);//查找对应号码的子节点 if(item!=NULL)//存在对应的联系人 { Contact contact=texttocontact(item->whatsThis(0)); //提取联系人信息 if(contact.number==newsms.number) { Chat *chat; if(chatdialogexist(contact,&chat))//联系人已有聊天窗口打开 { chat->activateWindow(); //则将窗口激活 chat->addnewmessage(numberToName(newsms.number),newsms);//在聊天窗口中显示此消息 if(recogniseNumber(newsms.number)==-1)//来自黑名单 newsms.from=newsms.now=2; //放入垃圾箱 else newsms.from=newsms.now=1; // 放入收件箱 allMessages.prepend(newsms); update(); return; } else //没有聊天窗口打开 { if(recogniseNumber(newsms.number)==-1)//来自黑名单 newsms.now=2; //查看后放入垃圾箱 else newsms.now=1; // 查看后放入收件箱 unreadsms.append(newsms); //保存在未读短信集合中 addchildblink(item); //让对应的子节点闪烁 update(); return; } } } else { //没有对应此号码的联系人 Contact newcontact; newcontact.name=QString::null; newcontact.number=newsms.number; newcontact.onLine=true; //将联系人设置为在线 strangers.append(newcontact); //保存未知联系人 QTreeWidgetItem *child=new QTreeWidgetItem(QStringList()<<(newcontact.name+":"+newcontact.number)); child->setIcon(0,QIcon(":/icon/icons/user.png")); child->setWhatsThis(0,newcontact.name+":"+newcontact.number); ui->contactsTreeWidget->topLevelItem(1)->addChild(child); //在联系人列表显示未知联系人 newsms.now=1; //将陌生人的信息存到收件箱 unreadsms.append(newsms); //添加未读消息 addchildblink(child); //设置为闪烁 update(); } } }
/* ============================================================================= * FUNCTION: lookforobject */ void lookforobject(void) { int i; int dx, dy; /* can't find objects is time is stopped */ if (c[TIMESTOP]) return; i=item[playerx][playery]; if (i == ONOTHING) return; showcell(playerx,playery); yrepcount=0; switch (i) { case OGOLDPILE: case OMAXGOLD: case OKGOLD: case ODGOLD: ogold(i); break; case OPOTION: Print("You find a magic potion"); i = iarg[playerx][playery]; if (potionknown[i]) Printf(" of %s",&potionname[i][1]); Print("."); add_option('d', "Drink", ""); add_option('t', "Take", ""); break; case OSCROLL: Print("You find a magic scroll"); i = iarg[playerx][playery]; if (scrollknown[i]) Printf(" of %s",&scrollname[i][1]); Print("."); if (c[BLINDCOUNT] == 0) add_option('r', "Read", ""); add_option('t', "Take", ""); break; case OALTAR: if (nearbymonst()) return; Print("There is a holy altar here."); set_callback("act_on_object"); add_option('p', "Pray", ""); add_option('d', "Desecrate", ""); add_option('i', "Ignore", ""); break; case OBOOK: Print("You find a book."); if (c[BLINDCOUNT] == 0) add_option('r', "Read", ""); add_option('t', "Take", ""); break; case OCOOKIE: Print("You find a fortune cookie."); add_option('e', "Eat", ""); add_option('t', "Take", ""); break; case OTHRONE: case OTHRONE2: if (nearbymonst()) return; Printf("There is %s here.", objectname[i]); add_option('p', "Pry Jewels", ""); add_option('s', "Sit", ""); break; case ODEADTHRONE: Printf("There is %s here.", objectname[i]); add_option('s', "Sit", ""); break; case OORB: if (nearbymonst()) return; finditem(i); break; case OBRASSLAMP: Print("You find a brass lamp."); add_option('r', "Rub", ""); add_option('t', "Take", ""); return; case OWWAND: if (nearbymonst()) return; finditem(i); break; case OHANDofFEAR: if (nearbymonst()) return; finditem(i); break; case OPIT: Print("You're standing at the top of a pit."); opit(); break; case OSTAIRSUP: Print("There is a circular staircase here."); add_option('u', "Up", ""); break; case OELEVATORUP: Print("You have found an express elevator going up."); oelevator(1); /* up */ break; case OELEVATORDOWN: Print("You have found an express elevator going down."); oelevator(-1); /* down */ break; case OFOUNTAIN: if (nearbymonst()) return; Print("There is a fountain here."); add_option('d', "Drink", ""); add_option('w', "Wash Yourself", ""); break; case OSTATUE: if (nearbymonst()) return; Print("You stand before a statue."); ostatue(); break; case OCHEST: Print("There is a chest here."); add_option('t', "Take", ""); add_option('o', "Open", ""); break; case OIVTELETRAP: if (rnd(11)<6) return; item[playerx][playery] = OTELEPORTER; case OTELEPORTER: /* * The player is being teleported, so obviously the player gets * to know that a teleport trap is here. * oteleport forces a screen redraw, so don't bother display anything * here. */ know[playerx][playery] = item[playerx][playery]; Print("Zaaaappp! You've been teleported!"); UlarnBeep(); nap(3000); oteleport(0); break; case OSCHOOL: if (nearbymonst()) return; Print("You have found the College of Ularn."); add_option('g', "Go in", ""); break; case OMIRROR: if (nearbymonst()) return; Print("There is a mirror here."); omirror(); break; case OBANK2: case OBANK: if (nearbymonst()) return; if (i==OBANK) { Print("You have found the bank of Ularn."); } else { Print("You have found a branch office of the bank of Ularn."); } add_option('g', "Go in", ""); break; case ODEADFOUNTAIN: if (nearbymonst()) return; Print("There is a dead fountain here."); break; case ODNDSTORE: if (nearbymonst()) return; Print("There is a DND store here."); add_option('g', "Go in", ""); break; case OSTAIRSDOWN: Print("There is a circular staircase here."); add_option('d', "Down", ""); break; case OOPENDOOR: Print("There is an open door here."); break; case OCLOSEDDOOR: /* can't move objects if time is stopped */ if (c[TIMESTOP]) return; dx = playerx; dy = playery; if (dropflag) return; Printf("You find %s",objectname[i]); set_callback("act_on_object"); add_option('o', "Open", ""); add_option('i', "Ignore", ""); break; case OENTRANCE: Print("You have found "); Print(objectname[OENTRANCE]); add_option('g', "Go in", ""); break; case OVOLDOWN: Print("You have found "); Print(objectname[OVOLDOWN]); add_option('c', "Climb down", ""); return; case OVOLUP: Print("You have found "); Print(objectname[OVOLUP]); add_option('c', "Climb up", ""); return; case OTRAPARROWIV: if (rnd(17)<13) return; /* for an arrow trap */ item[playerx][playery] = OTRAPARROW; case OTRAPARROW: Print("You are hit by an arrow!"); UlarnBeep(); /* for an arrow trap */ losehp(DIED_SHOT_BY_ARROW, rnd(10)+level); UpdateStatus(); return; case OIVDARTRAP: if (rnd(17)<13) return; /* for a dart trap */ item[playerx][playery] = ODARTRAP; case ODARTRAP: Print("You are hit by a dart!"); UlarnBeep(); /* for a dart trap */ losehp(DIED_HIT_BY_DART, rnd(5)); if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3; UpdateStatus(); return; case OIVTRAPDOOR: if (rnd(17)<13) return; /* for a trap door */ item[playerx][playery] = OTRAPDOOR; case OTRAPDOOR: for (i=0;i<IVENSIZE;i++) { if (iven[i]==OWWAND) { Print("You escape a trap door."); return; } } if ((level==DBOTTOM)||(level==VBOTTOM)) { Print("You fall through a trap door leading straight to HELL!"); UlarnBeep(); nap(3000); died(DIED_FELL_THROUGH_BOTTOMLESS_TRAPDOOR, 0); } Print("You fall through a trap door!"); UlarnBeep(); losehp(DIED_FELL_THROUGH_TRAPDOOR, rnd(5+level)); nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY); UpdateStatusAndEffects(); return; case OTRADEPOST: if (nearbymonst()) return; Print("You have found the Ularn trading Post."); add_option('g', "Go in", ""); return; case OHOME: if (nearbymonst()) return; Print("You have found your way home."); add_option('g', "Go in", ""); return; case OPAD: if (nearbymonst()) return; Print("You have found Dealer McDope's Hideout!"); add_option('g', "Go in", ""); return; case OSPEED: Print("You find some speed."); add_option('s', "Snort", ""); add_option('t', "Take", ""); break; case OSHROOMS: Print("You find some magic mushrooms."); add_option('e', "Eat", ""); add_option('t', "Take", ""); break; case OACID: Print("You find some LSD."); add_option('e', "Eat", ""); add_option('t', "Take", ""); break; case OHASH: Print("You find some hashish."); add_option('s', "Smoke", ""); add_option('t', "Take", ""); break; case OCOKE: Print("You find some cocaine."); add_option('s', "Snort", ""); add_option('t', "Take", ""); break; case OWALL: break; case OANNIHILATION: if (player_has_item(OSPHTALISMAN)) { Print("The Talisman of the Sphere protects you from annihilation!"); return; } /* annihilated by sphere of annihilation */ died(DIED_SPHERE_ANNIHILATION, 0); return; case OLRS: if (nearbymonst()) return; Print("There is an LRS office here."); add_option('g', "Go in", ""); break; default: finditem(i); break; } }