package mapped;

import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSMouseRecorder;

@ObfuscatedName("db")
public class MouseRecorder implements Runnable, RSMouseRecorder {
   @ObfuscatedName("at")
   boolean isRunning;
   @ObfuscatedName("ah")
   Object lock;
   @ObfuscatedName("ar")
   @ObfuscatedGetter(
      intValue = 635201825
   )
   int index;
   @ObfuscatedName("ao")
   int[] xs;
   @ObfuscatedName("ab")
   int[] ys;
   @ObfuscatedName("au")
   long[] millis;

   MouseRecorder() {
      this.isRunning = true;
      this.lock = new Object();
      this.index = 0;
      this.xs = new int[500];
      this.ys = new int[500];
      this.millis = new long[500];
   }

   public void run() {
      for(; this.isRunning; class219.method4260_base(50L)) {
         Object var1 = this.lock;
         synchronized(this.lock) {
            if(this.index < 500) {
               this.xs[this.index] = MouseHandler.MouseHandler_x;
               this.ys[this.index] = MouseHandler.MouseHandler_y;
               this.millis[this.index] = MouseHandler.MouseHandler_millis;
               ++this.index;
            }
         }
      }

   }

   public int getIndex() {
      return this.index;
   }

   public int[] getXs() {
      return this.xs;
   }

   public int[] getYs() {
      return this.ys;
   }

   public long[] getMillis() {
      return this.millis;
   }

   @ObfuscatedName("as")
   @ObfuscatedSignature(
      descriptor = "(IB)I",
      garbageValue = "-14"
   )
   public static int method2372_base(int var0) {
      class139 var2 = (class139)SequenceDefinition.SequenceDefinition_cachedModel.get((long)var0);
      class139 var1;
      if(var2 != null) {
         var1 = var2;
      } else {
         var2 = Login.method2197(SequenceDefinition.SequenceDefinition_animationsArchive, SequenceDefinition.SequenceDefinition_skeletonsArchive, var0, false);
         if(var2 != null) {
            SequenceDefinition.SequenceDefinition_cachedModel.put(var2, (long)var0);
         }

         var1 = var2;
      }

      return var1 == null?2:(var1.method3164_base()?0:1);
   }
}
