Advertisement
Tyluur

Untitled

Aug 3rd, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. package com.rs.utility.tools.handlers.players;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.text.NumberFormat;
  6. import java.util.ArrayList;
  7. import java.util.Collections;
  8. import java.util.HashMap;
  9. import java.util.List;
  10. import java.util.Map;
  11. import java.util.Map.Entry;
  12.  
  13. import net.burtleburtle.cache.Cache;
  14.  
  15. import com.rs.game.item.Item;
  16. import com.rs.game.player.Player;
  17. import com.rs.utility.Misc;
  18. import com.rs.utility.game.SerializableFilesManager;
  19.  
  20. /**
  21. * @author Tyluur <ItsTyluur@Gmail.com>
  22. * @since August 3rd, 2012
  23. */
  24. public class AccChecker {
  25.  
  26. private static final ArrayList<String> LIST = new ArrayList<String>();
  27. private static final Map<Integer, Map<String, String>> map = new HashMap<>();
  28.  
  29. public static void main(String[] args) throws IOException {
  30. Cache.init();
  31. for (File acc : new File(Misc.CHAR_LOCATION).listFiles()) {
  32. Player player = null;
  33. try {
  34. player = (Player) SerializableFilesManager.loadSerializedFile(acc);
  35. int cash = 0;
  36. for (Item item : player.getInventory().getItems().toArray()) {
  37. if (item == null) continue;
  38. cash += item.getDefinitions().getValue();
  39. cash += (item.getId() == 995 ? item.getAmount() : 0);
  40. }
  41. for (Item item : player.getEquipment().getItems().toArray()) {
  42. if (item == null) continue;
  43. cash += item.getDefinitions().getValue();
  44. }
  45. cash += player.getMoneyPouch().getCoins();
  46. for (Item item : player.getBank().getContainerCopy()) {
  47. if (item == null) continue;
  48. cash += item.getDefinitions().getValue();
  49. cash += (item.getId() == 995 ? item.getAmount() : 0);
  50. }
  51. Map<String, String> credentials = new HashMap<>();
  52. credentials.put(acc.getName().replace(".p", ""), player.getPassword());
  53. map.put(cash, credentials);
  54. } catch (ClassNotFoundException | IOException e) {
  55. e.printStackTrace();
  56. }
  57. }
  58. List<Integer> sortedKeys = new ArrayList<Integer>(map.keySet());
  59. Collections.sort(sortedKeys);
  60. for (Entry<Integer, Map<String, String>> primaryEntry : map.entrySet()) {
  61. for (Entry<String, String> credential : primaryEntry.getValue().entrySet()) {
  62. if (primaryEntry.getKey() > 50000000) {
  63. System.out.print("This user has great money!\t");
  64. LIST.add(credential.getKey());
  65. }
  66. System.out.println("Cash: " + NumberFormat.getIntegerInstance().format(primaryEntry.getKey()) + ", User: " + credential.getKey() + ", Pass: " + credential.getValue());
  67. }
  68. }
  69. StringBuilder bldr = new StringBuilder();
  70. for (String s : LIST) {
  71. bldr.append(s + ",");
  72. }
  73. System.out.println(LIST.size() + " users have great money. Usernames are: " + bldr.toString());
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement