Untitled
unknown
plain_text
a year ago
5.4 kB
6
Indexable
Never
// source.cpp button else if (cch.find("action|dialog_return\ndialog_name|\nbuttonClicked|leader_") != string::npos) { string target = cch.substr(55, cch.length() - 57).c_str(); int lock = 0, itemcount = 0, itemid = 0, sayi = 0; string name = "", names = ""; int gems = 0, opc = 0, level = 0, adml = 0, bpoi = 0; int dl = 0, bgl = 0, inv = 0, ggl = 0; int xp = 0; string path_ = "players/" + target + "_.json"; //cout << path_ << endl; json j; ifstream files(path_, ifstream::binary); if (files.fail()) break; files >> j; adml = j["adminLevel"].get<int>(); name = j["name"].get<string>(); gems = j["gems"].get<int>(); //opc = j["opc"].get<int>(); xp = j["xp"].get<int>(); level = j["level"].get<int>(); //bpoi = j["bpoi"].get<int>(); //lock += opc / 2; lock += level / 3; lock += gems / 20000; //lock += bpoi / 500; json a_ = j["inv"].get<json>(); json f_ = j["worlds_owned"].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; dl += itemcount; } if (itemid == 7188) { lock += itemcount * 10000; bgl += itemcount; } if (itemid == 8470) { lock += itemcount * 100000; ggl += itemcount; } inv++; } gamepacket_t h; h.Insert("OnDialogRequest"); h.Insert("\nadd_player_info|`0" + name + "``|" + to_string(level) + "|" + to_string(xp) + "|" + to_string(50 * ((level * level) + 2)) + "|\nadd_spacer|small|\nadd_label_with_icon|small|`oAccount net worth: `$" + to_string(lock) + " Locks``|left|242|\nadd_spacer|small|\nadd_label_with_icon|small|`oTotal Gems: `$" + to_string(gems) + "|left|112|\nadd_spacer|small|\nadd_label_with_icon|small|`oTotal Golden Gem Locks: `$" + to_string(ggl) + "|left|8470|\nadd_label_with_icon|small|`oTotal Blue Gem Locks: `$" + to_string(bgl) + "|left|7188|\nadd_label_with_icon|small|`oTotal Diamond Locks: `$" + to_string(dl) + "|left|1796|\nadd_spacer|small|\nadd_label_with_icon|small|`oTotal OPC: `$" + to_string(opc) + "|left|10668|\nadd_label_with_icon|small|`oTotal Breakpoint: `$" + to_string(bpoi) + "|left|18|\nadd_label_with_icon|small|`oInventory Size: `$" + to_string(inv) + " |left|9412|\nadd_label_with_icon|small|`oTotal Worlds Owned: `$"+ to_string(f_.size()) +"|left|1424|\nadd_spacer|small|\nadd_quick_exit|\nend_dialog|socialportal||Back|"); //h.Insert("\nadd_label|big|`w" + name + "|left||\nadd_spacer|small|\nadd_textbox|`oAccount worth: `$" + to_string(lock) + " Locks``|\nadd_spacer|small|\nadd_label_with_icon|small|`oGems: `$" + to_string(gems) + "|left|112|\nadd_spacer|small|\nadd_label_with_icon|small|`oBlue Gem Lock: `$" + to_string(bgl) + "|left|7188|\nadd_label_with_icon|small|`oDiamond Lock: `$" + to_string(dl) + "|left|1796|\nadd_spacer|small|\nadd_label_with_icon|small|`oOnline Point Currency: `$" + to_string(opc) + "|left|10668|\nadd_spacer|small|\nadd_quick_exit|\nadd_button|s|Close|"); h.CreatePacket(peer); } // world.h en ust using std::filesystem::directory_iterator; std::unordered_map<std::string, std::pair<int, int>> point; std::vector<std::pair< std::string, std::pair<int, int>>> sortfuck(point.begin(), point.end()); // world.h thread int lock = 0, itemcount = 0, itemid = 0, sayi = 0; string name = "", names = "", dname = ""; 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"]; 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 || opc < 5) continue; point[name] = {lock, adml}; lock = 0; } // world.h leaderboard socialportal std::sort(sortfuck.begin(), sortfuck.end(), [](const auto& a, const auto& b) { return a.second > b.second; }); string btn = ""; for (const auto& entry : sortfuck) { if (sayi < 100) { btn += "\nadd_button|leader_" + entry.first + "|`##" + to_string(sayi + 1) + " " + adminTag(entry.second.second) + "" + entry.first +"|"; sayi++; } } gamepacket_t k; k.Insert("OnDialogRequest"); k.Insert("\nadd_label_with_icon|big|`wLeaderboard|left|394|\nadd_spacer|small|\nadd_smalltext|`1Note: Requirement is 25 level and 5 OPC|\nadd_textbox|`oTop 100 Richest Player of Voidtopia:|\nadd_spacer|small|" + btn + "\nadd_spacer|\nadd_button|kk|Close|\nadd_quick_exit|"); k.CreatePacket(peer);