Ejemplo n.º 1
0
void jobSet(const QStringList &jobSetFiles, const QString &outFile)
{
	qDebug() << __FUNCTION__ << jobSetFiles.at(0) << jobSetFiles.at(1) << jobSetFiles.at(2) << outFile;

	QFile Wfile(outFile);
	if (!Wfile.open(QIODevice::WriteOnly))
	{
		qDebug() << "open " << outFile << "error.";
		return;
	}
	QDataStream iData(&Wfile);

	foreach(QString FilePath, jobSetFiles)
	{
		QFile RFile(FilePath);
		if (!RFile.open(QIODevice::ReadOnly | QIODevice::Text))
		{
			qDebug() << "open " << FilePath << "error.";
			return;
		}

		QString strTmp;
		QStringList list;
		qint32 i;

		QVector<Info_jobAdd> vec;
		Info_jobAdd job;

		RFile.readLine(1000);		//第一行是标题
		while (!RFile.atEnd())
		{
			i = 0;
			strTmp = RFile.readLine(1000);
			list = strTmp.split("\t");

			job.level = list.at(i++).toInt();
			job.exp = list.at(i++).toInt();
			job.hp = list.at(i++).toInt();
			job.mp = list.at(i++).toInt();
			job.dc1 = list.at(i++).toInt();
			job.dc2 = list.at(i++).toInt();
			job.mc1 = list.at(i++).toInt();
			job.mc2 = list.at(i++).toInt();
			job.sc1 = list.at(i++).toInt();
			job.sc2 = list.at(i++).toInt();
			job.ac = list.at(i++).toInt();
			job.mac = list.at(i++).toInt();

			vec.append(job);
		}
		RFile.close();

		iData << vec.size();	//单个职业设定文件长度。
		for (qint32 i = 0; i < vec.size(); i++)
		{
			iData << vec[i].level << vec[i].exp << vec[i].hp << vec[i].mp << vec[i].dc1 << vec[i].dc2 << vec[i].mc1 << vec[i].mc2
				<< vec[i].sc1 << vec[i].sc2 << vec[i].ac << vec[i].mac;
		}
	}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 5
0
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);
}
Ejemplo n.º 6
0
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);
}