string getpkmexpatcursql(const int id, const int exp) { ostringstream o; o << "" << "SELECT experience.experience " << "FROM pokemon_species " << " INNER JOIN experience " << " ON pokemon_species.growth_rate_id = experience.growth_rate_id " << "WHERE ( pokemon_species.id = " << id << " ) " << " AND ( experience.level = " << getpkmlevel(id,exp) << " ) " << "ORDER BY experience.experience "; return o.str(); }
void pkmviewer::displayPKM() { redisplayok = false; int index = 0; this->setWindowTitle(QString::fromStdWString(getpkmnickname(temppkm))); switch(temppkm->metlevel_otgender.otgender) { case Genders::male: ui->rbOTMale->setChecked(true); break; case Genders::female: ui->rbOTFemale->setChecked(true); break; default: ui->rbOTMale->setChecked(true); break; } ui->sbTID->setValue(temppkm->tid); ui->sbSID->setValue(temppkm->sid); ui->cbPKMSpecies->setCurrentIndex((int)(temppkm->species)-1); ui->sbSpecies->setValue(temppkm->species); // ui->cbPKMItem->setCurrentIndex((int)temppkm->item); index = ui->cbPKMItem->findData((int)temppkm->item); if ( index != -1 ) { // -1 for not found ui->cbPKMItem->setCurrentIndex(index); } ui->sbLevel->setValue(getpkmlevel(temppkm)); ui->sbEXP->setMaximum(getpkmexpatlevel(temppkm->species,100)); ui->sbEXP->setValue(temppkm->exp); int tnl = getpkmexptonext(temppkm); if(tnl == 0) { ui->pbTNL->setMinimum(0); ui->pbTNL->setMaximum(1); ui->pbTNL->setValue(0); ui->pbTNL->setTextVisible(false); } else { ui->pbTNL->setMinimum(getpkmexpatcur(temppkm)); ui->pbTNL->setMaximum(tnl + temppkm->exp); ui->pbTNL->setValue(temppkm->exp); ui->pbTNL->setTextVisible(true); } ui->lblTNL->setText(QString::number(getpkmexptonext(temppkm))); ui->txtNickname->setText(QString::fromStdWString(getpkmnickname(temppkm))); QColor otcolor = Qt::blue; if(temppkm->metlevel_otgender.otgender == Genders::female) { otcolor = Qt::red; } QPalette OTpalette = ui->txtOTName->palette(); OTpalette.setColor(ui->txtOTName->foregroundRole(), otcolor); ui->txtOTName->setPalette(OTpalette); ui->txtOTName->setText(QString::fromStdWString(getpkmotname(temppkm))); ui->cbNicknamed->setChecked(temppkm->ivs.isnicknamed); QPixmap * itempix = new QPixmap(); QGraphicsScene * itemscene = new QGraphicsScene(); *itempix = getitemimage(temppkm->item); itemscene->addPixmap(*itempix); ui->pbHeldItem->setScene(itemscene); QPixmap * type1pix = new QPixmap(); QGraphicsScene * type1scene = new QGraphicsScene(); *type1pix = gettypepic(lookuppkmtype(temppkm,1)); type1scene->addPixmap(*type1pix); ui->pbType1->setScene(type1scene); int pkmtype2 = 0; pkmtype2 = lookuppkmtype(temppkm,2); QPixmap * type2pix = new QPixmap(); QGraphicsScene * type2scene = new QGraphicsScene(); if(pkmtype2 != -1) { *type2pix = gettypepic(lookuppkmtype(temppkm,2)); } type2scene->addPixmap(*type2pix); ui->pbType2->setScene(type2scene); QPixmap * shinypix = new QPixmap(); QGraphicsScene * shinyscene = new QGraphicsScene(); if(getpkmshiny(temppkm)) { *shinypix = getshinystar(); } shinyscene->addPixmap(*shinypix); ui->pbShiny->setScene(shinyscene); QPixmap * spritepixmap = new QPixmap(); QGraphicsScene * spritescene = new QGraphicsScene(); *spritepixmap = getpkmsprite(temppkm); spritescene->addPixmap(*spritepixmap); ui->pbSprite->setScene(spritescene); ui->cbBall->setCurrentIndex(((int)temppkm->ball)-1); ui->sbHPIV->setValue(temppkm->ivs.hp); ui->sbAtkIV->setValue(temppkm->ivs.attack); ui->sbDefIV->setValue(temppkm->ivs.defense); ui->sbSpAtkIV->setValue(temppkm->ivs.spatk); ui->sbSpDefIV->setValue(temppkm->ivs.spdef); ui->sbSpeedIV->setValue(temppkm->ivs.speed); ui->sbHPEV->setValue(temppkm->evs.hp); ui->sbAtkEV->setValue(temppkm->evs.attack); ui->sbDefEV->setValue(temppkm->evs.defense); ui->sbSpAtkEV->setValue(temppkm->evs.spatk); ui->sbSpDefEV->setValue(temppkm->evs.spdef); ui->sbSpeedEV->setValue(temppkm->evs.speed); ui->cbNatures->setCurrentIndex(temppkm->nature); ui->cbMove1->setCurrentIndex(((int)temppkm->moves[0])-1); ui->cbMove2->setCurrentIndex((int)temppkm->moves[1]); ui->cbMove3->setCurrentIndex((int)temppkm->moves[2]); ui->cbMove4->setCurrentIndex((int)temppkm->moves[3]); ui->cbPKMAbility->setCurrentIndex(((int)temppkm->ability)-1); ui->sbPKRSDays->setValue(temppkm->pkrs.days); ui->sbPKRSStrain->setValue(temppkm->pkrs.strain); QSpinBox * movePPboxes[4] = {ui->sbMove1PP,ui->sbMove2PP,ui->sbMove3PP,ui->sbMove4PP}; QSpinBox * movePPUpboxes[4] = {ui->sbMove1PPUps,ui->sbMove2PPUps,ui->sbMove3PPUps,ui->sbMove4PPUps}; for(int movenum = 0; movenum < 4; movenum++) { movePPboxes[movenum]->setValue(temppkm->pp[movenum]); movePPUpboxes[movenum]->setValue(temppkm->ppup[movenum]); } int base = 10; if(ui->chkHex->isChecked()) { base = 16; } ui->txtPID->setText(QString::number(temppkm->pid,base).toUpper()); ui->chkNsPKM->setChecked(temppkm->dwability.n_pkm); ui->chkFateful->setChecked(temppkm->forms.fencounter); ui->sbMetLevel->setValue((int)temppkm->metlevel_otgender.metlevel); ui->chkMetAsEgg->setChecked(pkmmetasegg(temppkm)); ui->cbEggLocation->setEnabled(ui->chkMetAsEgg->isChecked()); ui->dtEggDate->setEnabled(ui->chkMetAsEgg->isChecked()); index = ui->cbHometown->findData((int)temppkm->hometown); if ( index != -1 ) { // -1 for not found ui->cbHometown->setCurrentIndex(index); } index = ui->cbCountry->findData((int)temppkm->country); if ( index != -1 ) { // -1 for not found ui->cbCountry->setCurrentIndex(index); } index = ui->cbMetLocation->findData((int)temppkm->met); if ( index != -1 ) { // -1 for not found ui->cbMetLocation->setCurrentIndex(index); } index = ui->cbEggLocation->findData((int)temppkm->eggmet); if ( index != -1 ) { // -1 for not found ui->cbEggLocation->setCurrentIndex(index); } ui->dtEggDate->setDate(QDate(((int)temppkm->eggdate.year)+2000,(int)temppkm->eggdate.month,(int)temppkm->eggdate.day)); ui->dtMetDate->setDate(QDate(((int)temppkm->metdate.year)+2000,(int)temppkm->metdate.month,(int)temppkm->metdate.day)); ui->cbForm->clear(); switch(temppkm->species) { case Species::castform: ui->cbForm->addItem(""); break; case Species::rotom: ui->cbForm->addItem(""); break; case Species::kyurem: ui->cbForm->addItem(""); break; case Species::genesect: ui->cbForm->addItem(""); break; default: break; } for(int formid = 0; formid < 28; formid++) { std::string formname = getpkmformname((int)temppkm->species,formid); if(formname != "") { ui->cbForm->addItem(QString::fromStdString(formname)); } } ui->cbForm->setEnabled(ui->cbForm->count() > 0); ui->cbForm->setCurrentIndex((int)temppkm->forms.form); redisplayok = true; updatepkrs(); updategenderpic(); updateabilityflavor(); updatemarks(); updatestats(); updatestatcolors(); updatemoveflavor(); updatemovepp(); updatemoveimages(); updatemoveinfo(); updatehidpwr(); }