Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.7 kB
2
Indexable
Never
std::unordered_map<int, std::string> point;

			int lock = 0, itemcount = 0, itemid = 0, sayi = 0;
			string name = "", names = "";
			int gems = 0, opc = 0, level = 0, adml = 0, bpoi = 0;

			for (auto& p : directory_iterator("players")) {
				json j;
				ifstream files(p.path());
				files >> j;
				adml = j["adminLevel"];
				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 (level < 25) continue;
				point[lock] = name;
			}
			std::vector<std::pair<int, std::string>> sortfuck;
			for (const auto& entry : point) {
				sortfuck.emplace_back(entry);
			}

			std::sort(sortfuck.begin(), sortfuck.end(),[](const auto& a, const auto& b) { return a.first > b.first; });
			string btn = "";
			for (const auto& entry : sortfuck) {
				if (sayi < 100) {
					btn += "\nadd_button|leader_" + entry.second + "|`##" + to_string(sayi + 1) + " `w" + entry.second + "|";
					sayi++;
				}
			}
			gamepacket_t k;
			k.Insert("OnDialogRequest");
			k.Insert("\nadd_label_with_icon|big|`wLeaderboard|left|394|\nadd_textbox|`oTop 100 Richest Players:|\nadd_spacer|small|" + btn + "\nadd_spacer|\nadd_button|kk|Close|\nadd_quick_exit|");
			k.CreatePacket(peer);