Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.2 kB
3
Indexable
Never
void refreshBoard() {
	int lock = 0, itemcount = 0, itemid = 0, sayi = 0;
	string name = "", names = "", dname = "";
	int gems = 0, level = 0, adml = 0, bpoi = 0;
	leader.clear();
	for (auto& p : directory_iterator("players")) {
		lock = 0;
		json j;
		ifstream files(p.path());
		if (files.fail() || !files.good()) continue;
		files >> j;
		if (j.empty()) continue;
		adml = j["adminLevel"];
		dname = j["d_name"];
		name = j["name"];
		gems = j["gems"];
		//opc = j["opc"];
		level = j["level"];
		//bpoi = j["bpoi"];
		//lock += opc / 2;
		//lock += level / 3;
		lock += gems / 20000;
		//lock += bpoi / 500;
		json a_ = j["inv"].get<json>();
		for (int i_ = 0; i_ < a_.size(); i_++) {
			itemid = a_.at(i_)["i"].get<int>();
			itemcount = a_.at(i_)["c"].get<int>();
			if (itemid == 242) {
				lock += itemcount;
			}
			if (itemid == 1796) {
				lock += itemcount * 100;
			}
			if (itemid == 7188) {
				lock += itemcount * 10000;
			}
			if (itemid == 8470) {
				lock += itemcount * 100000;
			}
		}
		if (level < 25 || adml >= 5) continue;
		leader.push_back(make_pair(name, make_pair(lock, adml)));
	}
}
Leave a Comment