Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
1.1 kB
1
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;
	for (auto& p : directory_iterator("players")) {
		json j;
		ifstream files(p.path());
		files >> j;
		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 / 2000;
		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)));
		lock = 0;
	}
}