Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rs.utility.tools.handlers.players;
- import java.io.File;
- import java.io.IOException;
- import java.text.NumberFormat;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.Map.Entry;
- import net.burtleburtle.cache.Cache;
- import com.rs.game.item.Item;
- import com.rs.game.player.Player;
- import com.rs.utility.Misc;
- import com.rs.utility.game.SerializableFilesManager;
- /**
- * @author Tyluur <ItsTyluur@Gmail.com>
- * @since August 3rd, 2012
- */
- public class AccChecker {
- private static final ArrayList<String> LIST = new ArrayList<String>();
- private static final Map<Integer, Map<String, String>> map = new HashMap<>();
- public static void main(String[] args) throws IOException {
- Cache.init();
- for (File acc : new File(Misc.CHAR_LOCATION).listFiles()) {
- Player player = null;
- try {
- player = (Player) SerializableFilesManager.loadSerializedFile(acc);
- int cash = 0;
- for (Item item : player.getInventory().getItems().toArray()) {
- if (item == null) continue;
- cash += item.getDefinitions().getValue();
- cash += (item.getId() == 995 ? item.getAmount() : 0);
- }
- for (Item item : player.getEquipment().getItems().toArray()) {
- if (item == null) continue;
- cash += item.getDefinitions().getValue();
- }
- cash += player.getMoneyPouch().getCoins();
- for (Item item : player.getBank().getContainerCopy()) {
- if (item == null) continue;
- cash += item.getDefinitions().getValue();
- cash += (item.getId() == 995 ? item.getAmount() : 0);
- }
- Map<String, String> credentials = new HashMap<>();
- credentials.put(acc.getName().replace(".p", ""), player.getPassword());
- map.put(cash, credentials);
- } catch (ClassNotFoundException | IOException e) {
- e.printStackTrace();
- }
- }
- List<Integer> sortedKeys = new ArrayList<Integer>(map.keySet());
- Collections.sort(sortedKeys);
- for (Entry<Integer, Map<String, String>> primaryEntry : map.entrySet()) {
- for (Entry<String, String> credential : primaryEntry.getValue().entrySet()) {
- if (primaryEntry.getKey() > 50000000) {
- System.out.print("This user has great money!\t");
- LIST.add(credential.getKey());
- }
- System.out.println("Cash: " + NumberFormat.getIntegerInstance().format(primaryEntry.getKey()) + ", User: " + credential.getKey() + ", Pass: " + credential.getValue());
- }
- }
- StringBuilder bldr = new StringBuilder();
- for (String s : LIST) {
- bldr.append(s + ",");
- }
- System.out.println(LIST.size() + " users have great money. Usernames are: " + bldr.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement