Advertisement
FALSkills

Settings/Varbit trackers

Mar 8th, 2020 (edited)
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. public static final Thread settingTracker = new Thread(new Runnable(){
  2. List<Integer> settingsToIgnore = new ArrayList<Integer>(Arrays.asList(795,1042,1021));
  3. @Override
  4. public void run() {
  5. settingsToIgnore.add();
  6. int[] current = getAllSettings();
  7. int[] cached = new int[current.length];
  8. setUpSettingValues(current,cached);
  9. while(true){
  10. General.sleep(500);
  11. current = getAllSettings();
  12. for(int i=0;i<current.length;i++){
  13. int knownValue = cached[i];
  14. int currentValue = current[i];
  15. if(currentValue!=knownValue && !settingsToIgnore.contains(i)){
  16. General.println("Setting: " + i + ": " + knownValue + " -> " + currentValue);
  17. cached[i] = currentValue;
  18. }
  19. }
  20. }
  21. }
  22. private void setUpSettingValues(int[] current,int[] values){
  23. for(int i=0;i<current.length;i++){
  24. values[i] = current[i];
  25. }
  26. }
  27.  
  28. private int[] getAllSettings(){
  29. int[] settings = new int[4000];
  30. for(int i=0;i<settings.length;i++){
  31. settings[i] = Game.getSetting(i);
  32. }
  33. return settings;
  34. }
  35.  
  36. });
  37. public static final Thread bitTracker = new Thread(new Runnable(){
  38. List<Integer> bitsToIgnore = new ArrayList<Integer>(Arrays.asList(4101,4118,4132,4606,8354,5983));
  39.  
  40. @Override
  41. public void run() {
  42. int[] cachedBitValues = new int[16000];
  43. for(int i=0;i<cachedBitValues.length;i++){
  44. cachedBitValues[i] = getBitValue(i);
  45. }
  46. while(true){
  47. General.sleep(500);
  48. for(int i=0;i<cachedBitValues.length;i++){
  49. int currentValue = getBitValue(i);
  50. int knownValue = cachedBitValues[i];
  51. if(currentValue!=knownValue && !bitsToIgnore.contains(i)){
  52. General.println("VarBit: " + i + ": " + knownValue + " -> " + currentValue);
  53. cachedBitValues[i] = currentValue;
  54. }
  55. }
  56. }
  57. }
  58.  
  59. private int getBitValue(int id){
  60. RSVarBit bit = RSVarBit.get(id);
  61. return bit != null ? bit.getValue() : -1;
  62. }
  63.  
  64. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement