void Skill_basic(const QString &inFile, const QString &outFile) { qDebug() << __FUNCTION__ << inFile << outFile; QFile Rfile(inFile); if (!Rfile.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "open " << inFile << "error."; return; } QFile Wfile(outFile); if (!Wfile.open(QIODevice::WriteOnly)) { qDebug() << "open " << outFile << "error."; return; } QString strTmp; QStringList list; quint32 i, ID, icon, lv, cd[4], type, no; QString name, descr, strImgPath; QDataStream iData(&Wfile); Rfile.readLine(1000); //第一行是标题 while (!Rfile.atEnd()) { strTmp = Rfile.readLine(1000); if (strTmp.isEmpty() || strTmp.isNull()) { //防止文件尾部有空白行。 break; } list = strTmp.split("\t"); i = 0; ID = list.at(i++).toUInt(); name = list.at(i++); icon = list.at(i++).toUInt(); lv = list.at(i++).toUInt(); cd[0] = list.at(i++).toUInt(); cd[1] = list.at(i++).toUInt(); cd[2] = list.at(i++).toUInt(); cd[3] = list.at(i++).toUInt(); type = list.at(i++).toUInt(); no = list.at(i++).toUInt(); descr = list.at(i++); iData << ID << name << icon << lv << cd[0] << cd[1] << cd[2] << cd[3] << type << no << descr; } Rfile.close(); Wfile.close(); qDebug() << __FUNCTION__ << "run over"; test_skill_basic(outFile); }
void skill_buff(const QString &inFile, const QString &outFile) { qDebug() << __FUNCTION__ << inFile << outFile; QFile Rfile(inFile); if (!Rfile.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "open " << inFile << "error."; return; } QFile Wfile(outFile); if (!Wfile.open(QIODevice::WriteOnly)) { qDebug() << "open " << outFile << "error."; return; } QString strTmp, name; QStringList list; qint32 i, ID, icon, time, type, targets, effectType, basic, add; bool control; QDataStream iData(&Wfile); Rfile.readLine(1000); //第一行是标题 while (!Rfile.atEnd()) { strTmp = Rfile.readLine(1000); if (strTmp.isEmpty() || strTmp.isNull()) { //防止文件尾部有空白行。 break; } list = strTmp.split("\t"); i = 0; ID = list.at(i++).toInt(); name = list.at(i++); icon = list.at(i++).toInt(); time = list.at(i++).toInt(); control = (list.at(i++).toInt() == 1); type = list.at(i++).toInt(); targets = list.at(i++).toInt(); effectType = list.at(i++).toInt(); basic = list.at(i++).toInt(); add = list.at(i++).toInt(); iData << ID << name << icon << time << control << type << targets << effectType << basic << add; } Rfile.close(); Wfile.close(); qDebug() << __FUNCTION__ << "run over"; test_skill_buff(outFile); }
void skill_summon(const QString &inFile, const QString &outFile) { qDebug() << __FUNCTION__ << inFile << outFile; QFile Rfile(inFile); if (!Rfile.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "open " << inFile << "error."; return; } QFile Wfile(outFile); if (!Wfile.open(QIODevice::WriteOnly)) { qDebug() << "open " << outFile << "error."; return; } QString strTmp; QStringList list; qint32 i, ID, photo, type, hp, damage1, damage2, defense; QDataStream iData(&Wfile); Rfile.readLine(1000); //第一行是标题 while (!Rfile.atEnd()) { strTmp = Rfile.readLine(1000); if (strTmp.isEmpty() || strTmp.isNull()) { //防止文件尾部有空白行。 break; } list = strTmp.split("\t"); i = 0; ID = list.at(i++).toInt(); photo = list.at(i++).toInt(); type = list.at(i++).toInt(); hp = list.at(i++).toInt(); damage1 = list.at(i++).toInt(); damage2 = list.at(i++).toInt(); defense = list.at(i++).toInt(); iData << ID << photo << type << hp << damage1 << damage2 << defense; } Rfile.close(); Wfile.close(); qDebug() << __FUNCTION__ << "run over"; test_skill_summon(outFile); }
void skill_treat(const QString &inFile, const QString &outFile) { qDebug() << __FUNCTION__ << inFile << outFile; QFile Rfile(inFile); if (!Rfile.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "open " << inFile << "error."; return; } QFile Wfile(outFile); if (!Wfile.open(QIODevice::WriteOnly)) { qDebug() << "open " << outFile << "error."; return; } QString strTmp, name; QStringList list; qint32 i, ID, targets, hpr_basic, hpr_add; QDataStream iData(&Wfile); Rfile.readLine(1000); //第一行是标题 while (!Rfile.atEnd()) { strTmp = Rfile.readLine(1000); if (strTmp.isEmpty() || strTmp.isNull()) { //防止文件尾部有空白行。 break; } list = strTmp.split("\t"); i = 0; ID = list.at(i++).toInt(); name = list.at(i++); targets = list.at(i++).toInt(); hpr_basic = list.at(i++).toInt(); hpr_add = list.at(i++).toInt(); iData << ID << name << targets << hpr_basic << hpr_add; } Rfile.close(); Wfile.close(); qDebug() << __FUNCTION__ << "run over"; test_skill_treat(outFile); }
void Equip(const QString &inFile, const QString &outFile) { qDebug() << __FUNCTION__ << inFile << outFile; QFile Rfile(inFile); if (!Rfile.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "open " << inFile << "error."; return; } QFile Wfile(outFile); if (!Wfile.open(QIODevice::WriteOnly)) { qDebug() << "open " << outFile << "error."; return; } QString strTmp; QStringList list; int i = 0, count = 0; QImage img; quint32 ID, photo, lv, st, sbv, sgv, luck, acc, sacred, ag, spd, md, ep, ed, ac1, ac2, mac1, mac2, dc1, dc2, mc1, mc2, sc1, sc2, need, needLvl, price; QString name, strImgPath; QDataStream iData(&Wfile); Rfile.readLine(1000); //第一行是标题 while (!Rfile.atEnd()) { strTmp = Rfile.readLine(1000); if (strTmp.isEmpty() || strTmp.isNull()) { //防止文件尾部有空白行。 break; } list = strTmp.split("\t"); i = 0; ID = list.at(i++).toUInt(); name = list.at(i++); photo = list.at(i++).toUInt(); strImgPath = QString("./Resources/equip/"); strImgPath += QString::number(photo) + QString(".png"); if (!QFile::exists(strImgPath)) { strImgPath = QString("./Resources/equip/0.png"); } img = QImage(strImgPath); if (img.isNull()) { qDebug() << "No Head:" << strImgPath; break; } lv = list.at(i++).toUInt(); st = list.at(i++).toUInt(); sbv = list.at(i++).toUInt(); sgv = list.at(i++).toUInt(); luck = list.at(i++).toUInt(); acc = list.at(i++).toUInt(); sacred = list.at(i++).toUInt(); ag = list.at(i++).toUInt(); spd = list.at(i++).toUInt(); md = list.at(i++).toUInt(); ep = list.at(i++).toUInt(); ed = list.at(i++).toUInt(); ac1 = list.at(i++).toUInt(); ac2 = list.at(i++).toUInt(); mac1 = list.at(i++).toUInt(); mac2 = list.at(i++).toUInt(); dc1 = list.at(i++).toUInt(); dc2 = list.at(i++).toUInt(); mc1 = list.at(i++).toUInt(); mc2 = list.at(i++).toUInt(); sc1 = list.at(i++).toUInt(); sc2 = list.at(i++).toUInt(); need = list.at(i++).toUInt(); needLvl = list.at(i++).toUInt(); price = list.at(i++).toUInt(); iData << ID << name << img << lv << st << sbv << sgv << luck << acc << sacred << ag << spd << md << ep << ed; iData << ac1 << ac2 << mac1 << mac2 << dc1 << dc2 << mc1 << mc2 << sc1 << sc2 << need << needLvl << price; ++count; } Rfile.close(); Wfile.close(); qDebug() << __FUNCTION__ << "run over. define " << count << "equips"; testEquip(outFile); }