package mapped;

import com.google.common.collect.ImmutableSet;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
import net.runelite.api.Hitsplat;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ActorDeath;
import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.GraphicChanged;
import net.runelite.api.events.HealthBarUpdated;
import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.InteractingChanged;
import net.runelite.api.events.OverheadTextChanged;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSActor;
import net.runelite.rs.api.RSActorSpotAnim;
import net.runelite.rs.api.RSHealthBar;
import net.runelite.rs.api.RSHealthBarDefinition;
import net.runelite.rs.api.RSHealthBarUpdate;
import net.runelite.rs.api.RSIterableNodeDeque;
import net.runelite.rs.api.RSIterableNodeHashTable;
import net.runelite.rs.api.RSNPC;
import net.runelite.rs.api.RSNode;
import net.runelite.rs.api.RSPlayer;

@ObfuscatedName("df")
public abstract class Actor extends Renderable implements RSActor {
   public static final Set combatInfoFilter;
   @ObfuscatedName("an")
   boolean isWalking;
   @ObfuscatedName("bf")
   @ObfuscatedGetter(
      intValue = -566542991
   )
   int x;
   @ObfuscatedName("bg")
   @ObfuscatedGetter(
      intValue = -119015489
   )
   int y;
   @ObfuscatedName("ba")
   @ObfuscatedGetter(
      intValue = -1115978189
   )
   int rotation;
   @ObfuscatedName("bm")
   @ObfuscatedGetter(
      intValue = 328670719
   )
   int field1198;
   @ObfuscatedName("bp")
   @ObfuscatedGetter(
      intValue = -708453853
   )
   int playerCycle;
   @ObfuscatedName("bw")
   @ObfuscatedGetter(
      intValue = 1507626977
   )
   int idleSequence;
   @ObfuscatedName("bj")
   @ObfuscatedGetter(
      intValue = 1755887541
   )
   int turnLeftSequence;
   @ObfuscatedName("bn")
   @ObfuscatedGetter(
      intValue = -1720527121
   )
   int turnRightSequence;
   @ObfuscatedName("bo")
   @ObfuscatedGetter(
      intValue = 403226013
   )
   int walkSequence;
   @ObfuscatedName("bt")
   @ObfuscatedGetter(
      intValue = -989384247
   )
   int walkBackSequence;
   @ObfuscatedName("bu")
   @ObfuscatedGetter(
      intValue = -2049900857
   )
   int walkLeftSequence;
   @ObfuscatedName("by")
   @ObfuscatedGetter(
      intValue = -670575641
   )
   int walkRightSequence;
   @ObfuscatedName("bh")
   @ObfuscatedGetter(
      intValue = 273209973
   )
   int runSequence;
   @ObfuscatedName("bz")
   @ObfuscatedGetter(
      intValue = 388785657
   )
   int field1185;
   @ObfuscatedName("bc")
   @ObfuscatedGetter(
      intValue = -2004441427
   )
   int field1186;
   @ObfuscatedName("bs")
   @ObfuscatedGetter(
      intValue = 660078083
   )
   int field1233;
   @ObfuscatedName("bx")
   @ObfuscatedGetter(
      intValue = -1801934665
   )
   int field1188;
   @ObfuscatedName("bb")
   @ObfuscatedGetter(
      intValue = -586042643
   )
   int field1189;
   @ObfuscatedName("bk")
   @ObfuscatedGetter(
      intValue = -1911959473
   )
   int field1190;
   @ObfuscatedName("br")
   @ObfuscatedGetter(
      intValue = 1857432021
   )
   int field1239;
   @ObfuscatedName("bq")
   String overheadText;
   @ObfuscatedName("cf")
   boolean field1206;
   @ObfuscatedName("cg")
   boolean field1174;
   @ObfuscatedName("cv")
   @ObfuscatedGetter(
      intValue = 2129131609
   )
   int overheadTextCyclesRemaining;
   @ObfuscatedName("cx")
   @ObfuscatedGetter(
      intValue = 788736699
   )
   int field1196;
   @ObfuscatedName("cp")
   @ObfuscatedGetter(
      intValue = -1899316695
   )
   int field1197;
   @ObfuscatedName("ce")
   int[] field1236;
   @ObfuscatedName("ct")
   byte hitSplatCount;
   @ObfuscatedName("cw")
   int[] hitSplatTypes;
   @ObfuscatedName("cq")
   int[] hitSplatValues;
   @ObfuscatedName("cl")
   int[] hitSplatCycles;
   @ObfuscatedName("cs")
   int[] hitSplatTypes2;
   @ObfuscatedName("co")
   int[] hitSplatValues2;
   @ObfuscatedName("cm")
   @ObfuscatedSignature(
      descriptor = "Lpm;"
   )
   IterableNodeDeque healthBars;
   @ObfuscatedName("cn")
   @ObfuscatedGetter(
      intValue = 2050397061
   )
   int targetIndex;
   @ObfuscatedName("cr")
   boolean false0;
   @ObfuscatedName("cj")
   @ObfuscatedGetter(
      intValue = -402115953
   )
   int field1208;
   @ObfuscatedName("ca")
   @ObfuscatedGetter(
      intValue = -1781317999
   )
   int field1178;
   @ObfuscatedName("cc")
   @ObfuscatedGetter(
      intValue = 1627124457
   )
   int field1210;
   @ObfuscatedName("cu")
   boolean field1211;
   @ObfuscatedName("ch")
   @ObfuscatedGetter(
      intValue = 320895825
   )
   int movementSequence;
   @ObfuscatedName("cb")
   @ObfuscatedGetter(
      intValue = 914542215
   )
   int movementFrame;
   @ObfuscatedName("cz")
   @ObfuscatedGetter(
      intValue = -1781899867
   )
   int movementFrameCycle;
   @ObfuscatedName("cy")
   @ObfuscatedGetter(
      intValue = 1428922331
   )
   int field1248;
   @ObfuscatedName("ck")
   @ObfuscatedGetter(
      intValue = -760216869
   )
   int sequence;
   @ObfuscatedName("cd")
   @ObfuscatedGetter(
      intValue = -1935303951
   )
   int sequenceFrame;
   @ObfuscatedName("dt")
   @ObfuscatedGetter(
      intValue = 1840118521
   )
   int sequenceFrameCycle;
   @ObfuscatedName("di")
   @ObfuscatedGetter(
      intValue = -945394067
   )
   int sequenceDelay;
   @ObfuscatedName("dk")
   @ObfuscatedGetter(
      intValue = 2089660561
   )
   int field1199;
   @ObfuscatedName("dd")
   @ObfuscatedSignature(
      descriptor = "Ltz;"
   )
   IterableNodeHashTable spotAnimations;
   @ObfuscatedName("dx")
   @ObfuscatedGetter(
      intValue = 1707756343
   )
   int graphicsCount;
   @ObfuscatedName("dh")
   @ObfuscatedGetter(
      intValue = 199035841
   )
   int field1209;
   @ObfuscatedName("du")
   @ObfuscatedGetter(
      intValue = 1567601611
   )
   int field1224;
   @ObfuscatedName("dg")
   @ObfuscatedGetter(
      intValue = -2005383469
   )
   int field1194;
   @ObfuscatedName("dc")
   @ObfuscatedGetter(
      intValue = -66691109
   )
   int field1203;
   @ObfuscatedName("do")
   @ObfuscatedGetter(
      intValue = -104636043
   )
   int spotAnimation;
   @ObfuscatedName("db")
   @ObfuscatedGetter(
      intValue = -886385083
   )
   int field1187;
   @ObfuscatedName("dm")
   @ObfuscatedGetter(
      intValue = 1723230919
   )
   int field1229;
   @ObfuscatedName("dr")
   @ObfuscatedGetter(
      intValue = -1534078943
   )
   int npcCycle;
   @ObfuscatedName("ds")
   @ObfuscatedGetter(
      intValue = 28818581
   )
   int defaultHeight;
   @ObfuscatedName("da")
   @ObfuscatedGetter(
      intValue = 2141692895
   )
   int field1232;
   @ObfuscatedName("dw")
   @ObfuscatedGetter(
      intValue = 2117888191
   )
   int field1215;
   @ObfuscatedName("dp")
   byte field1234;
   @ObfuscatedName("df")
   byte field1235;
   @ObfuscatedName("dv")
   byte field1171;
   @ObfuscatedName("dz")
   byte field1237;
   @ObfuscatedName("dl")
   @ObfuscatedGetter(
      intValue = 1089128167
   )
   int orientation;
   @ObfuscatedName("de")
   @ObfuscatedGetter(
      intValue = -1697894425
   )
   int field1192;
   @ObfuscatedName("dn")
   @ObfuscatedGetter(
      intValue = 1330672397
   )
   int field1240;
   @ObfuscatedName("dq")
   @ObfuscatedGetter(
      intValue = -1742381503
   )
   int pathLength;
   @ObfuscatedName("dj")
   int[] pathX;
   @ObfuscatedName("dy")
   int[] pathY;
   @ObfuscatedName("ec")
   @ObfuscatedSignature(
      descriptor = "[Liz;"
   )
   class228[] pathTraversed;
   @ObfuscatedName("ew")
   @ObfuscatedGetter(
      intValue = -107205191
   )
   int field1245;
   @ObfuscatedName("ex")
   @ObfuscatedGetter(
      intValue = 1253684241
   )
   int field1220;
   @ObfuscatedName("ev")
   @ObfuscatedGetter(
      intValue = -375551905
   )
   int field1247;
   public boolean dead;

   static {
      combatInfoFilter = ImmutableSet.of(Integer.valueOf(0), Integer.valueOf(2), Integer.valueOf(16), Integer.valueOf(17), Integer.valueOf(18), Integer.valueOf(19), new Integer[]{Integer.valueOf(20), Integer.valueOf(21), Integer.valueOf(22)});
   }

   Actor() {
      this.isWalking = false;
      this.field1198 = 1;
      this.idleSequence = -1;
      this.turnLeftSequence = -1;
      this.turnRightSequence = -1;
      this.walkSequence = -1;
      this.walkBackSequence = -1;
      this.walkLeftSequence = -1;
      this.walkRightSequence = -1;
      this.runSequence = -1;
      this.field1185 = -1;
      this.field1186 = -1;
      this.field1233 = -1;
      this.field1188 = -1;
      this.field1189 = -1;
      this.field1190 = -1;
      this.field1239 = -1;
      this.overheadText = null;
      this.overheadTextChanged(-1);
      this.field1174 = false;
      this.overheadTextCyclesRemaining = 100;
      this.field1196 = 0;
      this.field1197 = 0;
      this.field1236 = null;
      this.hitSplatCount = 0;
      this.hitSplatTypes = new int[4];
      this.hitSplatValues = new int[4];
      this.hitSplatCycles = new int[4];
      this.hitSplatTypes2 = new int[4];
      this.hitSplatValues2 = new int[4];
      this.healthBars = new IterableNodeDeque();
      this.targetIndex = -1;
      this.interactingChanged(-1);
      this.false0 = false;
      this.field1208 = -1;
      this.field1178 = -1;
      this.field1210 = -1;
      this.movementSequence = -1;
      this.movementFrame = 0;
      this.movementFrameCycle = 0;
      this.field1248 = 0;
      this.sequence = -1;
      this.animationChanged(-1);
      this.sequenceFrame = 0;
      this.sequenceFrameCycle = 0;
      this.sequenceDelay = 0;
      this.field1199 = 0;
      this.spotAnimations = new IterableNodeHashTable(4);
      this.graphicsCount = 0;
      this.npcCycle = 0;
      this.defaultHeight = 200;
      this.field1232 = -1;
      this.field1215 = -1;
      this.field1192 = 0;
      this.field1240 = 32;
      this.pathLength = 0;
      this.pathX = new int[10];
      this.pathY = new int[10];
      this.pathTraversed = new class228[10];
      this.field1245 = 0;
      this.field1220 = 0;
      this.field1247 = -1;
   }

   @ObfuscatedName("ai")
   @ObfuscatedSignature(
      descriptor = "(I)Z",
      garbageValue = "1221291483"
   )
   boolean isVisible_base() {
      return false;
   }

   @ObfuscatedName("cp")
   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "585669071"
   )
   final void method2461_base() {
      this.pathLength = 0;
      this.field1220 = 0;
   }

   @ObfuscatedName("ce")
   @ObfuscatedSignature(
      descriptor = "(IIIIIIB)V",
      garbageValue = "31"
   )
   final void addHitSplat_base(int var1, int var2, int var3, int var4, int var5, int var6) {
      boolean var7 = true;
      boolean var8 = true;

      int var9;
      for(var9 = 0; var9 < 4; ++var9) {
         if(this.hitSplatCycles[var9] > var5) {
            var7 = false;
         } else {
            var8 = false;
         }
      }

      var9 = -1;
      int var10 = -1;
      int var11 = 0;
      if(var1 >= 0) {
         HitSplatDefinition var12 = class149.method3275(var1);
         var10 = var12.field2069;
         var11 = var12.field2060;
      }

      int var14;
      if(var8) {
         if(var10 == -1) {
            this.applyActorHitsplat(var1, var2, var3, var4, var5, var6);
            return;
         }

         var9 = 0;
         var14 = 0;
         if(var10 == 0) {
            var14 = this.hitSplatCycles[0];
         } else if(var10 == 1) {
            var14 = this.hitSplatValues[0];
         }

         for(int var13 = 1; var13 < 4; ++var13) {
            if(var10 == 0) {
               if(this.hitSplatCycles[var13] < var14) {
                  var9 = var13;
                  var14 = this.hitSplatCycles[var13];
               }
            } else if(var10 == 1 && this.hitSplatValues[var13] < var14) {
               var9 = var13;
               var14 = this.hitSplatValues[var13];
            }
         }

         if(var10 == 1 && var14 >= var2) {
            this.applyActorHitsplat(var1, var2, var3, var4, var5, var6);
            return;
         }
      } else {
         if(var7) {
            this.hitSplatCount = 0;
         }

         for(var14 = 0; var14 < 4; ++var14) {
            byte var15 = this.hitSplatCount;
            this.hitSplatCount = (byte)((this.hitSplatCount + 1) % 4);
            if(this.hitSplatCycles[var15] <= var5) {
               var9 = var15;
               break;
            }
         }
      }

      if(var9 < 0) {
         this.applyActorHitsplat(var1, var2, var3, var4, var5, var6);
      } else {
         this.hitSplatTypes[var9] = var1;
         this.hitSplatValues[var9] = var2;
         this.hitSplatTypes2[var9] = var3;
         this.hitSplatValues2[var9] = var4;
         this.hitSplatCycles[var9] = var5 + var11 + var6;
         this.applyActorHitsplat(var1, var2, var3, var4, var5, var6);
      }
   }

   @ObfuscatedName("ci")
   @ObfuscatedSignature(
      descriptor = "(IIIIIII)V",
      garbageValue = "-2108984921"
   )
   final void addHealthBar_base(int var1, int var2, int var3, int var4, int var5, int var6) {
      this.setCombatInfo(var1, var2, var3, var4, var5, var6);
      HealthBarDefinition var7 = class92.method2445(var1);
      HealthBar var8 = null;
      HealthBar var9 = null;
      int var10 = var7.int2;
      int var11 = 0;

      HealthBar var12;
      for(var12 = (HealthBar)this.healthBars.method7290(); var12 != null; var12 = (HealthBar)this.healthBars.method7292()) {
         ++var11;
         if(var12.definition.field1870 == var7.field1870) {
            var12.put_base(var2 + var4, var5, var6, var3);
            return;
         }

         if(var12.definition.int1 <= var7.int1) {
            var8 = var12;
         }

         if(var12.definition.int2 > var10) {
            var9 = var12;
            var10 = var12.definition.int2;
         }
      }

      if(var9 != null || var11 < 4) {
         var12 = new HealthBar(var7);
         if(var8 == null) {
            this.healthBars.method7288(var12);
         } else {
            IterableNodeDeque.method7347(var12, var8);
         }

         var12.put_base(var2 + var4, var5, var6, var3);
         if(var11 >= 4) {
            var9.remove_base();
         }

      }
   }

   @ObfuscatedName("ct")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "-875440561"
   )
   final void removeHealthBar_base(int var1) {
      HealthBarDefinition var2 = class92.method2445(var1);

      for(HealthBar var3 = (HealthBar)this.healthBars.method7290(); var3 != null; var3 = (HealthBar)this.healthBars.method7292()) {
         if(var2 == var3.definition) {
            var3.remove_base();
            return;
         }
      }

   }

   @ObfuscatedName("cw")
   @ObfuscatedSignature(
      descriptor = "(IIIII)V",
      garbageValue = "-702211426"
   )
   void updateSpotAnimation_base(int var1, int var2, int var3, int var4) {
      int var5 = var4 + Client.cycle;
      ActorSpotAnim var6 = (ActorSpotAnim)this.spotAnimations.get((long)var1);
      if(var6 != null) {
         var6.remove_base();
         --this.graphicsCount;
      }

      if(var2 != 65535 && var2 != -1) {
         byte var7 = 0;
         if(var4 > 0) {
            var7 = -1;
         }

         this.spotAnimations.put(new ActorSpotAnim(var2, var3, var5, var7), (long)var1);
         ++this.graphicsCount;
         this.onGraphicChanged(var1, var2, var3, var4);
      } else {
         this.onGraphicChanged(var1, var2, var3, var4);
      }
   }

   @ObfuscatedName("cq")
   @ObfuscatedSignature(
      descriptor = "(B)Ltz;",
      garbageValue = "-1"
   )
   IterableNodeHashTable method2467() {
      return this.spotAnimations;
   }

   @ObfuscatedName("cl")
   @ObfuscatedSignature(
      descriptor = "(B)V",
      garbageValue = "98"
   )
   void clearSpotAnimations_base() {
      IterableNodeHashTableIterator var1 = new IterableNodeHashTableIterator(this.spotAnimations);

      for(ActorSpotAnim var2 = (ActorSpotAnim)var1.method8939(); var2 != null; var2 = (ActorSpotAnim)var1.next()) {
         var2.remove_base();
      }

      this.graphicsCount = 0;
      this.onGraphicCleared();
   }

   @ObfuscatedName("cs")
   @ObfuscatedSignature(
      descriptor = "(Lka;I)Lka;",
      garbageValue = "-1145530728"
   )
   Model method2469(Model var1) {
      if(this.graphicsCount == 0) {
         return var1;
      } else {
         IterableNodeHashTableIterator var2 = new IterableNodeHashTableIterator(this.spotAnimations);
         int var3 = var1.verticesCount;
         int var4 = var1.indicesCount;
         int var5 = var1.texIndicesCount;
         byte var6 = var1.field2951;

         for(ActorSpotAnim var7 = (ActorSpotAnim)var2.method8939(); var7 != null; var7 = (ActorSpotAnim)var2.next()) {
            if(var7.spotAnimationFrame != -1) {
               Model var8 = Canvas.method324(var7.spotAnimation).method3766();
               if(var8 != null) {
                  var3 += var8.verticesCount;
                  var4 += var8.indicesCount;
                  var5 += var8.texIndicesCount;
               }
            }
         }

         Model var10 = new Model(var3, var4, var5, var6);
         var10.method5644(var1);

         for(ActorSpotAnim var11 = (ActorSpotAnim)var2.method8939(); var11 != null; var11 = (ActorSpotAnim)var2.next()) {
            if(var11.spotAnimationFrame != -1) {
               Model var9 = Canvas.method324(var11.spotAnimation).method3762(var11.spotAnimationFrame);
               if(var9 != null) {
                  var9.offsetBy_base(0, -var11.spotAnimationHeight, 0);
                  var10.method5644(var9);
               }
            }
         }

         return var10;
      }
   }

   @ObfuscatedName("co")
   @ObfuscatedSignature(
      descriptor = "(B)V",
      garbageValue = "-60"
   )
   void method2480_base() {
      this.field1211 = false;
      this.field1208 = -1;
      this.field1178 = -1;
      this.field1210 = -1;
   }

   public int getPathLength() {
      return this.pathLength;
   }

   public void setCombatInfo(int var1, int var2, int var3, int var4, int var5, int var6) {
      HealthBarUpdated var7 = new HealthBarUpdated(this, var5);
      SpriteMask.client.getCallbacks().post(var7);
      if(var5 == 0) {
         if(this.isDead()) {
            return;
         }

         if(!combatInfoFilter.contains(Integer.valueOf(var1))) {
            return;
         }

         this.setDead(true);
         ActorDeath var8 = new ActorDeath(this);
         SpriteMask.client.getCallbacks().post(var8);
      } else if(var5 > 0) {
         if(this instanceof RSNPC && ((RSNPC)this).getId() == 319 && this.isDead()) {
            return;
         }

         this.setDead(false);
      }

   }

   public RSIterableNodeDeque getHealthBars() {
      return this.healthBars;
   }

   public int getRSInteracting() {
      return this.targetIndex;
   }

   public int getRSAnimation() {
      return this.sequence;
   }

   public net.runelite.api.Actor getInteracting() {
      RSPlayer var10000;
      try {
         int var1 = this.getRSInteracting();
         if(var1 == -1 || var1 == 65535 || var1 == 16777215) {
            var10000 = null;
            return var10000;
         }

         int var2 = 65536;
         if(var1 < var2) {
            RSNPC[] var6 = SpriteMask.client.getCachedNPCs();
            RSNPC var7 = var6[var1];
            return var7;
         }

         var1 -= var2;
         RSPlayer[] var3 = SpriteMask.client.getCachedPlayers();
         var10000 = var3[var1];
      } catch (ArrayIndexOutOfBoundsException var5) {
         SpriteMask.client.getLogger().error("", var5);
         return null;
      }

      return var10000;
   }

   public int getX() {
      return this.x;
   }

   public String getOverheadText() {
      return this.overheadText;
   }

   public RSIterableNodeHashTable getSpotAnims() {
      return this.spotAnimations;
   }

   public int[] getPathX() {
      return this.pathX;
   }

   public WorldPoint getWorldLocation() {
      return WorldPoint.fromLocal(SpriteMask.client, this.getPathX()[0] * 128 + 64, this.getPathY()[0] * 128 + 64, SpriteMask.client.getPlane());
   }

   public LocalPoint getLocalLocation() {
      return new LocalPoint(this.getX(), this.getY());
   }

   public int getY() {
      return this.y;
   }

   public void setGraphicsCount(int var1) {
      this.graphicsCount = var1;
   }

   public int getPoseAnimation() {
      return this.movementSequence;
   }

   public int getAnimation() {
      int var1 = this.getRSAnimation();
      switch(var1) {
      default:
         return var1;
      }
   }

   public void applyActorHitsplat(int var1, int var2, int var3, int var4, int var5, int var6) {
      Hitsplat var7 = new Hitsplat(var1, var2, var5 + var6);
      HitsplatApplied var8 = new HitsplatApplied();
      var8.setActor(this);
      var8.setHitsplat(var7);
      SpriteMask.client.getCallbacks().post(var8);
   }

   public int[] getPathY() {
      return this.pathY;
   }

   public boolean isDead() {
      return this.dead;
   }

   public int getGraphicsCount() {
      return this.graphicsCount;
   }

   public RSActorSpotAnim newActorSpotAnim(int var1, int var2, int var3, int var4) {
      return new ActorSpotAnim(var1, var2, var3, var4);
   }

   public int getActionFrame() {
      return this.sequenceFrame;
   }

   public void setDead(boolean var1) {
      this.dead = var1;
   }

   public void onGraphicCleared() {
      GraphicChanged var1 = new GraphicChanged();
      var1.setActor(this);
      SpriteMask.client.getCallbacks().post(var1);
   }

   public int getPoseFrame() {
      return this.movementFrame;
   }

   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "-1"
   )
   public void animationChanged(int var1) {
      AnimationChanged var2 = new AnimationChanged();
      var2.setActor(this);
      SpriteMask.client.getCallbacks().post(var2);
   }

   public int getSpotAnimFrame() {
      Iterator var1 = this.getSpotAnims().iterator();
      if(var1.hasNext()) {
         net.runelite.api.ActorSpotAnim var2 = (net.runelite.api.ActorSpotAnim)var1.next();
         return var2.getFrame();
      } else {
         return 0;
      }
   }

   public int getActionFrameCycle() {
      return this.sequenceFrameCycle;
   }

   public void setActionFrame(int var1) {
      this.sequenceFrame = var1;
   }

   public void onGraphicChanged(int var1, int var2, int var3, int var4) {
      GraphicChanged var5 = new GraphicChanged();
      var5.setActor(this);
      SpriteMask.client.getCallbacks().post(var5);
   }

   public void setPoseFrame(int var1) {
      this.movementFrame = var1;
   }

   public int getCurrentOrientation() {
      return this.rotation;
   }

   public int getPoseFrameCycle() {
      return this.movementFrameCycle;
   }

   public void setSpotAnimFrame(int var1) {
      Iterator var2 = this.getSpotAnims().iterator();
      if(var2.hasNext()) {
         net.runelite.api.ActorSpotAnim var3 = (net.runelite.api.ActorSpotAnim)var2.next();
         var3.setFrame(var1);
      }

   }

   public int getSpotAnimationFrameCycle() {
      Iterator var1 = this.getSpotAnims().iterator();
      if(var1.hasNext()) {
         net.runelite.api.ActorSpotAnim var2 = (net.runelite.api.ActorSpotAnim)var1.next();
         return var2.getCycle();
      } else {
         return 0;
      }
   }

   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "-1"
   )
   public void overheadTextChanged(int var1) {
      String var2 = this.getOverheadText();
      if(var2 != null) {
         OverheadTextChanged var3 = new OverheadTextChanged(this, var2);
         SpriteMask.client.getCallbacks().post(var3);
      }

   }

   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "-1"
   )
   public void interactingChanged(int var1) {
      InteractingChanged var2 = new InteractingChanged(this, this.getInteracting());
      SpriteMask.client.getCallbacks().post(var2);
   }

   public boolean isInteracting() {
      return this.getRSInteracting() != -1;
   }

   public int getHealthRatio() {
      RSIterableNodeDeque var1 = this.getHealthBars();
      if(var1 != null) {
         RSNode var2 = var1.getCurrent();
         RSNode var3 = var2.getNext();
         if(var3 instanceof RSHealthBar) {
            RSHealthBar var4 = (RSHealthBar)var3;
            RSIterableNodeDeque var5 = var4.getUpdates();
            RSNode var6 = var5.getCurrent();
            RSNode var7 = var6.getNext();
            if(var7 instanceof RSHealthBarUpdate) {
               RSHealthBarUpdate var8 = (RSHealthBarUpdate)var7;
               return var8.getHealthRatio();
            }
         }
      }

      return -1;
   }

   public int getHealthScale() {
      RSIterableNodeDeque var1 = this.getHealthBars();
      if(var1 != null) {
         RSNode var2 = var1.getCurrent();
         RSNode var3 = var2.getNext();
         if(var3 instanceof RSHealthBar) {
            RSHealthBar var4 = (RSHealthBar)var3;
            RSHealthBarDefinition var5 = var4.getDefinition();
            return var5.getHealthScale();
         }
      }

      return -1;
   }

   public Polygon getCanvasTilePoly() {
      return Perspective.getCanvasTilePoly(SpriteMask.client, this.getLocalLocation());
   }

   public Point getCanvasTextLocation(Graphics2D var1, String var2, int var3) {
      return Perspective.getCanvasTextLocation(SpriteMask.client, var1, this.getLocalLocation(), var2, var3);
   }

   public Point getCanvasImageLocation(BufferedImage var1, int var2) {
      return Perspective.getCanvasImageLocation(SpriteMask.client, this.getLocalLocation(), var1, var2);
   }

   public Point getCanvasSpriteLocation(net.runelite.api.SpritePixels var1, int var2) {
      return Perspective.getCanvasSpriteLocation(SpriteMask.client, this.getLocalLocation(), var1, var2);
   }

   public Point getMinimapLocation() {
      return Perspective.localToMinimap(SpriteMask.client, this.getLocalLocation());
   }

   public void createSpotAnim(int var1, int var2, int var3, int var4) {
      RSIterableNodeHashTable var5 = this.getSpotAnims();
      net.runelite.api.ActorSpotAnim var6 = (net.runelite.api.ActorSpotAnim)var5.get((long)var1);
      if(var6 != null) {
         var6.unlink();
         this.setGraphicsCount(this.getGraphicsCount() - 1);
      }

      if(var2 != -1) {
         byte var7 = 0;
         if(var4 > 0) {
            var7 = -1;
         }

         var5.put(this.newActorSpotAnim(var2, var3, SpriteMask.client.getGameCycle() + var4, var7), (long)var1);
         this.setGraphicsCount(this.getGraphicsCount() + 1);
      }

   }

   public boolean hasSpotAnim(int var1) {
      Iterator var2 = this.getSpotAnims().iterator();

      net.runelite.api.ActorSpotAnim var3;
      do {
         if(!var2.hasNext()) {
            return false;
         }

         var3 = (net.runelite.api.ActorSpotAnim)var2.next();
      } while(var3.getId() != var1);

      return true;
   }

   public void removeSpotAnim(int var1) {
      net.runelite.api.ActorSpotAnim var2 = (net.runelite.api.ActorSpotAnim)this.getSpotAnims().get((long)var1);
      if(var2 != null) {
         var2.unlink();
         this.setGraphicsCount(this.getGraphicsCount() - 1);
      }

   }

   public void clearSpotAnims() {
      this.getSpotAnims().clear();
      this.setGraphicsCount(0);
   }

   public WorldArea getWorldArea() {
      int var1 = 1;
      if(this instanceof net.runelite.api.NPC) {
         net.runelite.api.NPCComposition var2 = ((net.runelite.api.NPC)this).getComposition();
         if(var2 != null && var2.getConfigs() != null) {
            var2 = var2.transform();
         }

         if(var2 != null) {
            var1 = var2.getSize();
         }
      }

      return new WorldArea(this.getWorldLocation(), var1, var1);
   }

   public boolean isMoving() {
      return this.getPathLength() > 0;
   }

   public int getGraphic() {
      Iterator var1 = this.getSpotAnims().iterator();
      if(var1.hasNext()) {
         net.runelite.api.ActorSpotAnim var2 = (net.runelite.api.ActorSpotAnim)var1.next();
         return var2.getId();
      } else {
         return -1;
      }
   }

   public void setGraphic(int var1) {
      if(var1 == -1) {
         this.getSpotAnims().clear();
         this.setGraphicsCount(0);
      } else {
         Iterator var2 = this.getSpotAnims().iterator();
         if(var2.hasNext()) {
            net.runelite.api.ActorSpotAnim var3 = (net.runelite.api.ActorSpotAnim)var2.next();
            var3.setId(var1);
         } else {
            RSActorSpotAnim var4 = this.newActorSpotAnim(var1, 0, 0, 0);
            this.getSpotAnims().put(var4, 0L);
            this.setGraphicsCount(this.getGraphicsCount() + 1);
         }
      }

   }

   public int getGraphicHeight() {
      Iterator var1 = this.getSpotAnims().iterator();
      if(var1.hasNext()) {
         net.runelite.api.ActorSpotAnim var2 = (net.runelite.api.ActorSpotAnim)var1.next();
         return var2.getHeight();
      } else {
         return 0;
      }
   }

   public void setGraphicHeight(int var1) {
      Iterator var2 = this.getSpotAnims().iterator();
      if(var2.hasNext()) {
         net.runelite.api.ActorSpotAnim var3 = (net.runelite.api.ActorSpotAnim)var2.next();
         var3.setHeight(var1);
      }

   }

   public int getIdlePoseAnimation() {
      return this.idleSequence;
   }

   public void setIdlePoseAnimation(int var1) {
      this.idleSequence = var1;
   }

   public int getIdleRotateLeft() {
      return this.turnLeftSequence;
   }

   public void setIdleRotateLeft(int var1) {
      this.turnLeftSequence = var1;
   }

   public int getIdleRotateRight() {
      return this.turnRightSequence;
   }

   public void setIdleRotateRight(int var1) {
      this.turnRightSequence = var1;
   }

   public int getWalkAnimation() {
      return this.walkSequence;
   }

   public void setWalkAnimation(int var1) {
      this.walkSequence = var1;
   }

   public int getWalkRotate180() {
      return this.walkBackSequence;
   }

   public void setWalkRotate180(int var1) {
      this.walkBackSequence = var1;
   }

   public int getWalkRotateLeft() {
      return this.walkLeftSequence;
   }

   public void setWalkRotateLeft(int var1) {
      this.walkLeftSequence = var1;
   }

   public int getWalkRotateRight() {
      return this.walkRightSequence;
   }

   public void setWalkRotateRight(int var1) {
      this.walkRightSequence = var1;
   }

   public int getRunAnimation() {
      return this.runSequence;
   }

   public void setRunAnimation(int var1) {
      this.runSequence = var1;
   }

   public void setOverheadText(String var1) {
      this.overheadText = var1;
   }

   public int getOverheadCycle() {
      return this.overheadTextCyclesRemaining;
   }

   public void setOverheadCycle(int var1) {
      this.overheadTextCyclesRemaining = var1;
   }

   public int[] getHitsplatTypes() {
      return this.hitSplatTypes;
   }

   public int[] getHitsplatValues() {
      return this.hitSplatValues;
   }

   public int[] getHitsplatCycles() {
      return this.hitSplatCycles;
   }

   public void setPoseAnimation(int var1) {
      this.movementSequence = var1;
   }

   public void setAnimation(int var1) {
      this.sequence = var1;
   }

   public int getLogicalHeight() {
      return this.defaultHeight;
   }

   public int getOrientation() {
      return this.orientation;
   }

   public int getAnimationFrame() {
      return this.sequenceFrame;
   }

   public void setAnimationFrame(int var1) {
      this.sequenceFrame = var1;
   }

   @ObfuscatedName("ac")
   @ObfuscatedSignature(
      descriptor = "(Lbm;Lpf;Lpf;I)V",
      garbageValue = "1431524852"
   )
   static void method2496(GameEngine var0, Font var1, Font var2) {
      Client.loginScreenClick(var0, var1, var2);
      int var6;
      int var78;
      int var79;
      boolean var93;
      if(Login.worldSelectOpen) {
         class223 var76 = Client.field724;
         class223 var4 = var76;

         while(true) {
            if(!var4.method4324_base()) {
               if(MouseHandler.MouseHandler_lastButton != 1 && (class19.mouseCam || MouseHandler.MouseHandler_lastButton != 4)) {
                  break;
               }

               int var77 = Login.xPadding + 280;
               if(MouseHandler.MouseHandler_lastPressedX >= var77 && MouseHandler.MouseHandler_lastPressedX <= var77 + 14 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedY <= 18) {
                  VarcInt.changeWorldSelectSorting_base(0, 0);
                  break;
               }

               if(MouseHandler.MouseHandler_lastPressedX >= var77 + 15 && MouseHandler.MouseHandler_lastPressedX <= var77 + 80 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedY <= 18) {
                  VarcInt.changeWorldSelectSorting_base(0, 1);
                  break;
               }

               var6 = Login.xPadding + 390;
               if(MouseHandler.MouseHandler_lastPressedX >= var6 && MouseHandler.MouseHandler_lastPressedX <= var6 + 14 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedY <= 18) {
                  VarcInt.changeWorldSelectSorting_base(1, 0);
                  break;
               }

               if(MouseHandler.MouseHandler_lastPressedX >= var6 + 15 && MouseHandler.MouseHandler_lastPressedX <= var6 + 80 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedY <= 18) {
                  VarcInt.changeWorldSelectSorting_base(1, 1);
                  break;
               }

               var78 = Login.xPadding + 500;
               if(MouseHandler.MouseHandler_lastPressedX >= var78 && MouseHandler.MouseHandler_lastPressedX <= var78 + 14 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedY <= 18) {
                  VarcInt.changeWorldSelectSorting_base(2, 0);
                  break;
               }

               if(MouseHandler.MouseHandler_lastPressedX >= var78 + 15 && MouseHandler.MouseHandler_lastPressedX <= var78 + 80 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedY <= 18) {
                  VarcInt.changeWorldSelectSorting_base(2, 1);
                  break;
               }

               var79 = Login.xPadding + 610;
               if(MouseHandler.MouseHandler_lastPressedX >= var79 && MouseHandler.MouseHandler_lastPressedX <= var79 + 14 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedY <= 18) {
                  VarcInt.changeWorldSelectSorting_base(3, 0);
                  break;
               }

               if(MouseHandler.MouseHandler_lastPressedX >= var79 + 15 && MouseHandler.MouseHandler_lastPressedX <= var79 + 80 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedY <= 18) {
                  VarcInt.changeWorldSelectSorting_base(3, 1);
                  break;
               }

               if(MouseHandler.MouseHandler_lastPressedX >= Login.xPadding + 708 && MouseHandler.MouseHandler_lastPressedY >= 4 && MouseHandler.MouseHandler_lastPressedX <= Login.xPadding + 708 + 50 && MouseHandler.MouseHandler_lastPressedY <= 20) {
                  Login.worldSelectOpen = false;
                  Client.worldSelectionScreenToggled(-1);
                  class250.leftTitleSprite.drawAt_base(Login.xPadding, 0);
                  //Login.rightTitleSprite.drawAt_base(Login.xPadding + 382, 0);
                  //Login.logoSprite.drawAt_base(Login.xPadding + 382 - Login.logoSprite.subWidth / 2, 18);
                  break;
               }

               if(Login.hoveredWorldIndex != -1) {
                  World var80 = class361.World_worlds[Login.hoveredWorldIndex];
                  if(var80.isDeadman_base()) {
                     var80.field808 = "beta";
                  }

                  boolean var10 = false;
                  if(var80.properties != Client.worldProperties) {
                     var93 = (Client.worldProperties & class522.field5109.rsOrdinal_base()) != 0;
                     boolean var94 = var80.isDeadman_base();
                     if(var93 && !var94 || !var93 && var94) {
                        var10 = true;
                     }
                  }

                  class28.method449(var80);
                  Login.worldSelectOpen = false;
                  Client.worldSelectionScreenToggled(-1);
                  class250.leftTitleSprite.drawAt_base(Login.xPadding, 0);
                  //Login.rightTitleSprite.drawAt_base(Login.xPadding + 382, 0);
                  //Login.logoSprite.drawAt_base(Login.xPadding + 382 - Login.logoSprite.subWidth / 2, 18);
                  if(var10) {
                     ByteArrayPool.method7920_base();
                  }
               } else {
                  if(Login.worldSelectPage > 0 && Varps.worldSelectLeftSprite != null && MouseHandler.MouseHandler_lastPressedX >= 0 && MouseHandler.MouseHandler_lastPressedX <= Varps.worldSelectLeftSprite.subWidth && MouseHandler.MouseHandler_lastPressedY >= class47.canvasHeight / 2 - 50 && MouseHandler.MouseHandler_lastPressedY <= class47.canvasHeight / 2 + 50) {
                     --Login.worldSelectPage;
                  }

                  if(Login.worldSelectPage < Login.worldSelectPagesCount && class105.worldSelectRightSprite != null && MouseHandler.MouseHandler_lastPressedX >= Language.canvasWidth - class105.worldSelectRightSprite.subWidth - 5 && MouseHandler.MouseHandler_lastPressedX <= Language.canvasWidth && MouseHandler.MouseHandler_lastPressedY >= class47.canvasHeight / 2 - 50 && MouseHandler.MouseHandler_lastPressedY <= class47.canvasHeight / 2 + 50) {
                     ++Login.worldSelectPage;
                  }
               }
               break;
            }

            if(var4.field2360 == 13) {
               Login.worldSelectOpen = false;
               Client.worldSelectionScreenToggled(-1);
               class250.leftTitleSprite.drawAt_base(Login.xPadding, 0);
               // Login.rightTitleSprite.drawAt_base(Login.xPadding + 382, 0);
               //Login.logoSprite.drawAt_base(Login.xPadding + 382 - Login.logoSprite.subWidth / 2, 18);
               break;
            }

            if(var4.field2360 == 96) {
               if(Login.worldSelectPage > 0 && Varps.worldSelectLeftSprite != null) {
                  --Login.worldSelectPage;
               }
            } else if(var4.field2360 == 97 && Login.worldSelectPage < Login.worldSelectPagesCount && class105.worldSelectRightSprite != null) {
               ++Login.worldSelectPage;
            }
         }

      } else {
         if((MouseHandler.MouseHandler_lastButton == 1 || !class19.mouseCam && MouseHandler.MouseHandler_lastButton == 4) && MouseHandler.MouseHandler_lastPressedX >= Login.xPadding + 765 - 50 && MouseHandler.MouseHandler_lastPressedY >= 453) {
            WorldMapIcon_1.clientPreferences.method2571_base(!WorldMapIcon_1.clientPreferences.method2631_base());
            if(!WorldMapIcon_1.clientPreferences.method2631_base()) {
               ArrayList var3 = new ArrayList();
               var3.add(new MusicSong(class514.archive6, "scape main", "", 255, false));
               PendingSpawn.method2459_base(var3, 0, 0, 0, 100, false);
            } else {
               WorldMapRenderer.method4769_base(0, 0);
            }

            class472.method8564_base();
         }

         if(Client.gameState != 5) {
            if(-1L == Login.field928) {
               Login.field928 = SpotAnimationDefinition.method3775_base() + 1000L;
            }

            long var37 = SpotAnimationDefinition.method3775_base();
            boolean var5;
            if(Client.archiveLoaders != null && Client.archiveLoadersDone < Client.archiveLoaders.size()) {
               while(true) {
                  if(Client.archiveLoadersDone >= Client.archiveLoaders.size()) {
                     var5 = true;
                     break;
                  }

                  ArchiveLoader var39 = (ArchiveLoader)Client.archiveLoaders.get(Client.archiveLoadersDone);
                  if(!var39.isLoaded_base()) {
                     var5 = false;
                     break;
                  }

                  ++Client.archiveLoadersDone;
               }
            } else {
               var5 = true;
            }

            if(var5 && Login.field906 == -1L) {
               Login.field906 = var37;
               if(Login.field906 > Login.field928) {
                  Login.field928 = Login.field906;
               }
            }

            if(Client.gameState == 10 || Client.gameState == 11) {
               if(class85.clientLanguage == Language.Language_EN) {
                  if(MouseHandler.MouseHandler_lastButton == 1 || !class19.mouseCam && MouseHandler.MouseHandler_lastButton == 4) {
                     var6 = Login.xPadding + 5;
                     short var7 = 463;
                     byte var8 = 100;
                     byte var40 = 35;
                     if(MouseHandler.MouseHandler_lastPressedX >= var6 && MouseHandler.MouseHandler_lastPressedX <= var6 + var8 && MouseHandler.MouseHandler_lastPressedY >= var7 && MouseHandler.MouseHandler_lastPressedY <= var7 + var40) {
                        if(class241.loadWorlds_base()) {
                           Login.worldSelectOpen = true;
                           Client.worldSelectionScreenToggled(-1);
                           Login.worldSelectPage = 0;
                           Login.worldSelectPagesCount = 0;
                        }

                        return;
                     }
                  }

                  if(class542.World_request != null && class241.loadWorlds_base()) {
                     Login.worldSelectOpen = true;
                     Client.worldSelectionScreenToggled(-1);
                     Login.worldSelectPage = 0;
                     Login.worldSelectPagesCount = 0;
                  }
               }

               var6 = MouseHandler.MouseHandler_lastButton;
               var78 = MouseHandler.MouseHandler_lastPressedX;
               var79 = MouseHandler.MouseHandler_lastPressedY;
               if(var6 == 0) {
                  var78 = MouseHandler.MouseHandler_x;
                  var79 = MouseHandler.MouseHandler_y;
               }

               if(!class19.mouseCam && var6 == 4) {
                  var6 = 1;
               }

               class223 var9 = Client.field724;
               class223 var41 = var9;
               short var82;
               int var83;
               if(Login.loginIndex == 0) {
                  var93 = false;

                  while(var41.method4324_base()) {
                     if(var41.field2360 == 84) {
                        var93 = true;
                     }
                  }

                  var83 = class157.loginBoxCenter - 80;
                  var82 = 291;
                  if(var6 == 1 && var78 >= var83 - 75 && var78 <= var83 + 75 && var79 >= var82 - 20 && var79 <= var82 + 20) {
                     HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                  }

                  var83 = class157.loginBoxCenter + 80;
                  if(var6 == 1 && var78 >= var83 - 75 && var78 <= var83 + 75 && var79 >= var82 - 20 && var79 <= var82 + 20 || var93) {
                     if((Client.worldProperties & class522.field5111.rsOrdinal_base()) != 0) {
                        Login.Login_response0 = "";
                        Login.Login_response1 = "This is a <col=00ffff>Beta<col=ffffff> world.";
                        Login.Login_response2 = "Your normal account will not be affected.";
                        Login.Login_response3 = "";
                        UserComparator7.method2966_base(1);
                        class150.method3281_base();
                     } else if((Client.worldProperties & class522.field5095.rsOrdinal_base()) != 0) {
                        if((Client.worldProperties & class522.field5103.rsOrdinal_base()) != 0) {
                           Login.Login_response1 = "This is a <col=ffff00>High Risk <col=ff0000>PvP<col=ffffff> world.";
                           Login.Login_response2 = "Players can attack each other almost everywhere";
                           Login.Login_response3 = "and the Protect Item prayer won\'t work.";
                        } else {
                           Login.Login_response1 = "This is a <col=ff0000>PvP<col=ffffff> world.";
                           Login.Login_response2 = "Players can attack each other";
                           Login.Login_response3 = "almost everywhere.";
                        }

                        Login.Login_response0 = "Warning!";
                        UserComparator7.method2966_base(1);
                        class150.method3281_base();
                     } else if((Client.worldProperties & class522.field5103.rsOrdinal_base()) != 0) {
                        Login.Login_response1 = "This is a <col=ffff00>High Risk<col=ffffff> world.";
                        Login.Login_response2 = "The Protect Item prayer will";
                        Login.Login_response3 = "not work on this world.";
                        Login.Login_response0 = "Warning!";
                        UserComparator7.method2966_base(1);
                        class150.method3281_base();
                     } else {
                        SoundSystem.Login_promptCredentials_base(false);
                     }
                  }
               } else {
                  int var11;
                  short var12;
                  if(Login.loginIndex == 1) {
                     while(true) {
                        if(!var41.method4324_base()) {
                           var11 = class157.loginBoxCenter - 80;
                           var12 = 321;
                           if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                              SoundSystem.Login_promptCredentials_base(false);
                           }

                           var11 = class157.loginBoxCenter + 80;
                           if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                              UserComparator7.method2966_base(0);
                           }
                           break;
                        }

                        if(var41.field2360 == 84) {
                           SoundSystem.Login_promptCredentials_base(false);
                        } else if(var41.field2360 == 13) {
                           UserComparator7.method2966_base(0);
                        }
                     }
                  } else {
                     int var15;
                     short var81;
                     if(Login.loginIndex == 2) {
                        var81 = 201;
                        var11 = var81 + 52;
                        if(var6 == 1 && var79 >= var11 - 12 && var79 < var11 + 2) {
                           Login.currentLoginField = 0;
                        }

                        var11 += 15;
                        if(var6 == 1 && var79 >= var11 - 12 && var79 < var11 + 2) {
                           Login.currentLoginField = 1;
                        }

                        var11 += 15;
                        var81 = 361;
                        if(Login.field918 != null) {
                           var83 = Login.field918.highX / 2;
                           if(var6 == 1 && var78 >= Login.field918.lowX - var83 && var78 <= var83 + Login.field918.lowX && var79 >= var81 - 15 && var79 < var81) {
                              switch(Login.field931) {
                              case 1:
                                 HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                                 return;
                              case 2:
                                 HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                              }
                           }
                        }

                        var83 = class157.loginBoxCenter - 80;
                        var82 = 321;
                        if(var6 == 1 && var78 >= var83 - 75 && var78 <= var83 + 75 && var79 >= var82 - 20 && var79 <= var82 + 20) {
                           class478.method8609_base();
                           return;
                        }

                        var83 = Login.loginBoxX + 180 + 80;
                        if(var6 == 1 && var78 >= var83 - 75 && var78 <= var83 + 75 && var79 >= var82 - 20 && var79 <= var82 + 20) {
                           UserComparator7.method2966_base(0);
                           Login.Login_username = "";
                           Client.onUsernameChanged(-1);
                           Login.Login_password = "";
                           class53.field350 = 0;
                           NpcOverrides.otp = "";
                           Login.field920 = true;
                        }

                        var83 = class157.loginBoxCenter + -117;
                        var82 = 277;
                        Login.field916 = var78 >= var83 && var78 < var83 + NPCComposition.field1966 && var79 >= var82 && var79 < var82 + class113.field1426;
                        if(var6 == 1 && Login.field916) {
                           Client.Login_isUsernameRemembered = !Client.Login_isUsernameRemembered;
                           if(!Client.Login_isUsernameRemembered && WorldMapIcon_1.clientPreferences.method2593_base() != null) {
                              WorldMapIcon_1.clientPreferences.method2586_base((String)null);
                           }
                        }

                        var83 = class157.loginBoxCenter + 24;
                        var82 = 277;
                        Login.field919 = var78 >= var83 && var78 < var83 + NPCComposition.field1966 && var79 >= var82 && var79 < var82 + class113.field1426;
                        if(var6 == 1 && Login.field919) {
                           WorldMapIcon_1.clientPreferences.method2583_base(!WorldMapIcon_1.clientPreferences.method2543_base());
                           if(!WorldMapIcon_1.clientPreferences.method2543_base()) {
                              Login.Login_username = "";
                              Client.onUsernameChanged(-1);
                              WorldMapIcon_1.clientPreferences.method2586_base((String)null);
                              class150.method3281_base();
                           }
                        }

                        while(true) {
                           int var88;
                           Transferable var104;
                           do {
                              while(true) {
                                 label1776:
                                 do {
                                    while(true) {
                                       while(var41.method4324_base()) {
                                          if(var41.field2360 != 13) {
                                             if(Login.currentLoginField != 0) {
                                                continue label1776;
                                             }

                                             char var87 = var41.field2363;

                                             for(var15 = 0; var15 < "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"ï¿½$%^&*()-_=+[{]};:\'@#~,<.>/?\\| ".length() && var87 != "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"ï¿½$%^&*()-_=+[{]};:\'@#~,<.>/?\\| ".charAt(var15); ++var15) {
                                                ;
                                             }

                                             if(var41.field2360 == 85 && Login.Login_username.length() > 0) {
                                                Login.Login_username = Login.Login_username.substring(0, Login.Login_username.length() - 1);
                                                Client.onUsernameChanged(-1);
                                             }

                                             if(var41.field2360 == 84 || var41.field2360 == 80) {
                                                Login.currentLoginField = 1;
                                             }

                                             if(WorldMapScaleHandler.method5058_base(var41.field2363) && Login.Login_username.length() < 320) {
                                                Login.Login_username = Login.Login_username + var41.field2363;
                                                Client.onUsernameChanged(-1);
                                             }
                                          } else {
                                             UserComparator7.method2966_base(0);
                                             Login.Login_username = "";
                                             Client.onUsernameChanged(-1);
                                             Login.Login_password = "";
                                             class53.field350 = 0;
                                             NpcOverrides.otp = "";
                                             Login.field920 = true;
                                          }
                                       }

                                       return;
                                    }
                                 } while(Login.currentLoginField != 1);

                                 if(var41.field2360 == 85 && Login.Login_password.length() > 0) {
                                    Login.Login_password = Login.Login_password.substring(0, Login.Login_password.length() - 1);
                                 } else if(var41.field2360 == 84 || var41.field2360 == 80) {
                                    Login.currentLoginField = 0;
                                    if(var41.field2360 == 84) {
                                       Login.Login_username = Login.Login_username.trim();
                                       Client.onUsernameChanged(-1);
                                       if(Login.Login_username.length() == 0) {
                                          class139.setLoginResponseString_base("", "Please enter your email address.", "");
                                          return;
                                       }

                                       if(Login.Login_password.length() == 0) {
                                          class139.setLoginResponseString_base("", "Please enter your password.", "");
                                          return;
                                       }

                                       class139.setLoginResponseString_base("", "Connecting to server...", "");
                                       VerticalAlignment.method3754_base(false);
                                       WorldMapSection2.updateGameState_base(20);
                                       return;
                                    }
                                 }

                                 if((var41.method4316_base(82) || var41.method4316_base(87)) && var41.field2360 == 67) {
                                    Clipboard var103 = Toolkit.getDefaultToolkit().getSystemClipboard();
                                    var104 = var103.getContents(SpriteMask.client);
                                    var88 = 20 - Login.Login_password.length();
                                    break;
                                 }

                                 if(DirectByteArrayCopier.method6830_base(var41.field2363) && WorldMapScaleHandler.method5058_base(var41.field2363) && Login.Login_password.length() < 20) {
                                    Login.Login_password = Login.Login_password + var41.field2363;
                                 }
                              }
                           } while(var88 <= 0);

                           try {
                              String var89 = (String)var104.getTransferData(DataFlavor.stringFlavor);
                              int var92 = Math.min(var88, var89.length());

                              for(int var19 = 0; var19 < var92; ++var19) {
                                 if(!DirectByteArrayCopier.method6830_base(var89.charAt(var19)) || !WorldMapScaleHandler.method5058_base(var89.charAt(var19))) {
                                    UserComparator7.method2966_base(3);
                                    return;
                                 }
                              }

                              Login.Login_password = Login.Login_password + var89.substring(0, var92);
                           } catch (UnsupportedFlavorException var74) {
                              ;
                           } catch (IOException var75) {
                              ;
                           }
                        }
                     } else {
                        Bounds var44;
                        if(Login.loginIndex == 3) {
                           var11 = Login.loginBoxX + 180;
                           var12 = 241;
                           var44 = var1.method7670(25, "need to log in using the <u=ffd200><col=ffd200>Jagex Launcher</col></u> instead.".length() - 34, "need to log in using the <u=ffd200><col=ffd200>Jagex Launcher</col></u> instead.", var11, var12);
                           if(var6 == 1 && var44.method8373_base(var78, var79)) {
                              HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                           }

                           var11 = Login.loginBoxX + 180;
                           var12 = 276;
                           if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                              ClientPreferences.method2645_base(false);
                           }

                           var11 = Login.loginBoxX + 180;
                           var12 = 326;
                           if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                              HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                              return;
                           }
                        } else {
                           int var14;
                           if(Login.loginIndex == 4) {
                              var11 = Login.loginBoxX + 180 - 80;
                              var12 = 321;
                              if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                 NpcOverrides.otp.trim();
                                 if(NpcOverrides.otp.length() != 6) {
                                    class139.setLoginResponseString_base("", "Please enter a 6-digit PIN.", "");
                                    return;
                                 }

                                 class53.field350 = Integer.parseInt(NpcOverrides.otp);
                                 NpcOverrides.otp = "";
                                 VerticalAlignment.method3754_base(true);
                                 class139.setLoginResponseString_base("", "Connecting to server...", "");
                                 WorldMapSection2.updateGameState_base(20);
                                 return;
                              }

                              if(var6 == 1 && var78 >= Login.loginBoxX + 180 - 9 && var78 <= Login.loginBoxX + 180 + 130 && var79 >= 263 && var79 <= 296) {
                                 Login.field920 = !Login.field920;
                              }

                              if(var6 == 1 && var78 >= Login.loginBoxX + 180 - 34 && var78 <= Login.loginBoxX + 34 + 180 && var79 >= 351 && var79 <= 363) {
                                 HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                              }

                              var11 = Login.loginBoxX + 180 + 80;
                              if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                 UserComparator7.method2966_base(0);
                                 Login.Login_username = "";
                                 Client.onUsernameChanged(-1);
                                 Login.Login_password = "";
                                 class53.field350 = 0;
                                 NpcOverrides.otp = "";
                              }

                              while(var41.method4324_base()) {
                                 boolean var13 = false;

                                 for(var14 = 0; var14 < "1234567890".length(); ++var14) {
                                    if(var41.field2363 == "1234567890".charAt(var14)) {
                                       var13 = true;
                                       break;
                                    }
                                 }

                                 if(var41.field2360 == 13) {
                                    UserComparator7.method2966_base(0);
                                    Login.Login_username = "";
                                    Client.onUsernameChanged(-1);
                                    Login.Login_password = "";
                                    class53.field350 = 0;
                                    NpcOverrides.otp = "";
                                 } else {
                                    if(var41.field2360 == 85 && NpcOverrides.otp.length() > 0) {
                                       NpcOverrides.otp = NpcOverrides.otp.substring(0, NpcOverrides.otp.length() - 1);
                                    }

                                    if(var41.field2360 == 84) {
                                       NpcOverrides.otp.trim();
                                       if(NpcOverrides.otp.length() != 6) {
                                          class139.setLoginResponseString_base("", "Please enter a 6-digit PIN.", "");
                                          return;
                                       }

                                       class53.field350 = Integer.parseInt(NpcOverrides.otp);
                                       NpcOverrides.otp = "";
                                       VerticalAlignment.method3754_base(true);
                                       class139.setLoginResponseString_base("", "Connecting to server...", "");
                                       WorldMapSection2.updateGameState_base(20);
                                       return;
                                    }

                                    if(var13 && NpcOverrides.otp.length() < 6) {
                                       NpcOverrides.otp = NpcOverrides.otp + var41.field2363;
                                    }
                                 }
                              }
                           } else if(Login.loginIndex == 5) {
                              var11 = Login.loginBoxX + 180 - 80;
                              var12 = 321;
                              Buffer var22;
                              if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                 Login.Login_username = Login.Login_username.trim();
                                 Client.onUsernameChanged(-1);
                                 if(Login.Login_username.length() == 0) {
                                    class139.setLoginResponseString_base("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address.");
                                 } else {
                                    long var48;
                                    try {
                                       URL var45 = new URL(WorldMapID.method4938_base("services", false) + "m=accountappeal/login.ws");
                                       URLConnection var17 = var45.openConnection();
                                       var17.setRequestProperty("connection", "close");
                                       var17.setDoInput(true);
                                       var17.setDoOutput(true);
                                       var17.setConnectTimeout(5000);
                                       OutputStreamWriter var106 = new OutputStreamWriter(var17.getOutputStream());
                                       var106.write("data1=req");
                                       var106.flush();
                                       InputStream var107 = var17.getInputStream();
                                       Buffer var90 = new Buffer(new byte[1000]);

                                       while(true) {
                                          int var21 = var107.read(var90.array, var90.offset, 1000 - var90.offset);
                                          if(var21 == -1) {
                                             var90.offset = 0;
                                             long var50 = var90.readLong_base();
                                             var48 = var50;
                                             break;
                                          }

                                          var90.offset += var21;
                                          if(var90.offset >= 1000) {
                                             var48 = 0L;
                                             break;
                                          }
                                       }
                                    } catch (Exception var70) {
                                       var48 = 0L;
                                    }

                                    byte var84;
                                    if(var48 == 0L) {
                                       var84 = 5;
                                    } else {
                                       String var108 = Login.Login_username;
                                       Random var91 = new Random();
                                       Buffer var110 = new Buffer(128);
                                       var22 = new Buffer(128);
                                       int[] var96 = new int[]{var91.nextInt(), var91.nextInt(), (int)(var48 >> 32), (int)var48};
                                       var110.writeByte_base(10);

                                       int var24;
                                       for(var24 = 0; var24 < 4; ++var24) {
                                          var110.writeInt_base(var91.nextInt());
                                       }

                                       var110.writeInt_base(var96[0]);
                                       var110.writeInt_base(var96[1]);
                                       var110.writeLong_base(var48);
                                       var110.writeLong_base(0L);

                                       for(var24 = 0; var24 < 4; ++var24) {
                                          var110.writeInt_base(var91.nextInt());
                                       }

                                       var110.encryptRsa_base(class72.field870, class72.field871);
                                       var22.writeByte_base(10);

                                       for(var24 = 0; var24 < 3; ++var24) {
                                          var22.writeInt_base(var91.nextInt());
                                       }

                                       var22.writeLong_base(var91.nextLong());
                                       var22.writeLongMedium_base(var91.nextLong());
                                       class354.method6860(var22);
                                       var22.writeLong_base(var91.nextLong());
                                       var22.encryptRsa_base(class72.field870, class72.field871);
                                       var24 = ClanChannel.stringCp1252NullTerminatedByteSize_base(var108);
                                       if(var24 % 8 != 0) {
                                          var24 += 8 - var24 % 8;
                                       }

                                       Buffer var97 = new Buffer(var24);
                                       var97.writeStringCp1252NullTerminated_base(var108);
                                       var97.offset = var24;
                                       var97.xteaEncryptAll_base(var96);
                                       Buffer var26 = new Buffer(var22.offset + var110.offset + var97.offset + 5);
                                       var26.writeByte_base(2);
                                       var26.writeByte_base(var110.offset);
                                       var26.writeBytes_base(var110.array, 0, var110.offset);
                                       var26.writeByte_base(var22.offset);
                                       var26.writeBytes_base(var22.array, 0, var22.offset);
                                       var26.writeShort_base(var97.offset);
                                       var26.writeBytes_base(var97.array, 0, var97.offset);
                                       String var98 = class415.method7821_base(var26.array);

                                       byte var18;
                                       try {
                                          URL var99 = new URL(WorldMapID.method4938_base("services", false) + "m=accountappeal/login.ws");
                                          URLConnection var100 = var99.openConnection();
                                          var100.setDoInput(true);
                                          var100.setDoOutput(true);
                                          var100.setConnectTimeout(5000);
                                          OutputStreamWriter var101 = new OutputStreamWriter(var100.getOutputStream());
                                          var101.write("data2=" + WorldMapData_0.method4483_base(var98) + "&dest=" + WorldMapData_0.method4483_base("passwordchoice.ws"));
                                          var101.flush();
                                          InputStream var102 = var100.getInputStream();
                                          var26 = new Buffer(new byte[1000]);

                                          while(true) {
                                             int var32 = var102.read(var26.array, var26.offset, 1000 - var26.offset);
                                             if(var32 == -1) {
                                                var101.close();
                                                var102.close();
                                                String var111 = new String(var26.array);
                                                if(var111.startsWith("OFFLINE")) {
                                                   var18 = 4;
                                                } else if(var111.startsWith("WRONG")) {
                                                   var18 = 7;
                                                } else if(var111.startsWith("RELOAD")) {
                                                   var18 = 3;
                                                } else if(var111.startsWith("Not permitted for social network accounts.")) {
                                                   var18 = 6;
                                                } else {
                                                   var26.xteaDecryptAll_base(var96);

                                                   while(var26.offset > 0 && var26.array[var26.offset - 1] == 0) {
                                                      --var26.offset;
                                                   }

                                                   var111 = new String(var26.array, 0, var26.offset);
                                                   boolean var33;
                                                   if(var111 == null) {
                                                      var33 = false;
                                                   } else {
                                                      label1946: {
                                                         try {
                                                            new URL(var111);
                                                         } catch (MalformedURLException var68) {
                                                            var33 = false;
                                                            break label1946;
                                                         }

                                                         var33 = true;
                                                      }
                                                   }

                                                   if(var33) {
                                                      HealthBar.openURL_base(var111, true, false);
                                                      var18 = 2;
                                                   } else {
                                                      var18 = 5;
                                                   }
                                                }
                                                break;
                                             }

                                             var26.offset += var32;
                                             if(var26.offset >= 1000) {
                                                var18 = 5;
                                                break;
                                             }
                                          }
                                       } catch (Throwable var69) {
                                          var69.printStackTrace();
                                          var18 = 5;
                                       }

                                       var84 = var18;
                                    }

                                    switch(var84) {
                                    case 2:
                                       class139.setLoginResponseString_base(Strings.field4189, Strings.field4118, Strings.field4191);
                                       UserComparator7.method2966_base(6);
                                       break;
                                    case 3:
                                       class139.setLoginResponseString_base("", "Error connecting to server.", "");
                                       break;
                                    case 4:
                                       class139.setLoginResponseString_base("The part of the website you are trying", "to connect to is offline at the moment.", "Please try again later.");
                                       break;
                                    case 5:
                                       class139.setLoginResponseString_base("Sorry, there was an error trying to", "log you in to this part of the website.", "Please try again later.");
                                       break;
                                    case 6:
                                       class139.setLoginResponseString_base("", "Error connecting to server.", "");
                                       break;
                                    case 7:
                                       class139.setLoginResponseString_base("You must enter a valid login to proceed. For accounts", "created after 24th November 2010, please use your", "email address. Otherwise please use your username.");
                                    }
                                 }

                                 return;
                              }

                              var11 = Login.loginBoxX + 180 + 80;
                              if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                 SoundSystem.Login_promptCredentials_base(true);
                              }

                              var82 = 361;
                              if(class7.field21 != null) {
                                 var14 = class7.field21.highX / 2;
                                 if(var6 == 1 && var78 >= class7.field21.lowX - var14 && var78 <= var14 + class7.field21.lowX && var79 >= var82 - 15 && var79 < var82) {
                                    HealthBar.openURL_base(WorldMapID.method4938_base("secure", true) + "m=weblogin/g=oldscape/cant_log_in", true, false);
                                 }
                              }

                              while(var41.method4324_base()) {
                                 boolean var85 = false;

                                 for(var15 = 0; var15 < "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"ï¿½$%^&*()-_=+[{]};:\'@#~,<.>/?\\| ".length(); ++var15) {
                                    if(var41.field2363 == "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"ï¿½$%^&*()-_=+[{]};:\'@#~,<.>/?\\| ".charAt(var15)) {
                                       var85 = true;
                                       break;
                                    }
                                 }

                                 if(var41.field2360 == 13) {
                                    SoundSystem.Login_promptCredentials_base(true);
                                 } else {
                                    if(var41.field2360 == 85 && Login.Login_username.length() > 0) {
                                       Login.Login_username = Login.Login_username.substring(0, Login.Login_username.length() - 1);
                                       Client.onUsernameChanged(-1);
                                    }

                                    if(var41.field2360 == 84) {
                                       Login.Login_username = Login.Login_username.trim();
                                       Client.onUsernameChanged(-1);
                                       if(Login.Login_username.length() == 0) {
                                          class139.setLoginResponseString_base("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address.");
                                       } else {
                                          long var52;
                                          try {
                                             URL var46 = new URL(WorldMapID.method4938_base("services", false) + "m=accountappeal/login.ws");
                                             URLConnection var47 = var46.openConnection();
                                             var47.setRequestProperty("connection", "close");
                                             var47.setDoInput(true);
                                             var47.setDoOutput(true);
                                             var47.setConnectTimeout(5000);
                                             OutputStreamWriter var20 = new OutputStreamWriter(var47.getOutputStream());
                                             var20.write("data1=req");
                                             var20.flush();
                                             InputStream var54 = var47.getInputStream();
                                             var22 = new Buffer(new byte[1000]);

                                             while(true) {
                                                int var56 = var54.read(var22.array, var22.offset, 1000 - var22.offset);
                                                if(var56 == -1) {
                                                   var22.offset = 0;
                                                   long var57 = var22.readLong_base();
                                                   var52 = var57;
                                                   break;
                                                }

                                                var22.offset += var56;
                                                if(var22.offset >= 1000) {
                                                   var52 = 0L;
                                                   break;
                                                }
                                             }
                                          } catch (Exception var73) {
                                             var52 = 0L;
                                          }

                                          byte var86;
                                          if(0L == var52) {
                                             var86 = 5;
                                          } else {
                                             String var109 = Login.Login_username;
                                             Random var95 = new Random();
                                             Buffer var23 = new Buffer(128);
                                             Buffer var61 = new Buffer(128);
                                             int[] var25 = new int[]{var95.nextInt(), var95.nextInt(), (int)(var52 >> 32), (int)var52};
                                             var23.writeByte_base(10);

                                             int var62;
                                             for(var62 = 0; var62 < 4; ++var62) {
                                                var23.writeInt_base(var95.nextInt());
                                             }

                                             var23.writeInt_base(var25[0]);
                                             var23.writeInt_base(var25[1]);
                                             var23.writeLong_base(var52);
                                             var23.writeLong_base(0L);

                                             for(var62 = 0; var62 < 4; ++var62) {
                                                var23.writeInt_base(var95.nextInt());
                                             }

                                             var23.encryptRsa_base(class72.field870, class72.field871);
                                             var61.writeByte_base(10);

                                             for(var62 = 0; var62 < 3; ++var62) {
                                                var61.writeInt_base(var95.nextInt());
                                             }

                                             var61.writeLong_base(var95.nextLong());
                                             var61.writeLongMedium_base(var95.nextLong());
                                             class354.method6860(var61);
                                             var61.writeLong_base(var95.nextLong());
                                             var61.encryptRsa_base(class72.field870, class72.field871);
                                             var62 = ClanChannel.stringCp1252NullTerminatedByteSize_base(var109);
                                             if(var62 % 8 != 0) {
                                                var62 += 8 - var62 % 8;
                                             }

                                             Buffer var27 = new Buffer(var62);
                                             var27.writeStringCp1252NullTerminated_base(var109);
                                             var27.offset = var62;
                                             var27.xteaEncryptAll_base(var25);
                                             Buffer var28 = new Buffer(var27.offset + var61.offset + var23.offset + 5);
                                             var28.writeByte_base(2);
                                             var28.writeByte_base(var23.offset);
                                             var28.writeBytes_base(var23.array, 0, var23.offset);
                                             var28.writeByte_base(var61.offset);
                                             var28.writeBytes_base(var61.array, 0, var61.offset);
                                             var28.writeShort_base(var27.offset);
                                             var28.writeBytes_base(var27.array, 0, var27.offset);
                                             String var29 = class415.method7821_base(var28.array);

                                             byte var65;
                                             try {
                                                URL var30 = new URL(WorldMapID.method4938_base("services", false) + "m=accountappeal/login.ws");
                                                URLConnection var31 = var30.openConnection();
                                                var31.setDoInput(true);
                                                var31.setDoOutput(true);
                                                var31.setConnectTimeout(5000);
                                                OutputStreamWriter var55 = new OutputStreamWriter(var31.getOutputStream());
                                                var55.write("data2=" + WorldMapData_0.method4483_base(var29) + "&dest=" + WorldMapData_0.method4483_base("passwordchoice.ws"));
                                                var55.flush();
                                                InputStream var63 = var31.getInputStream();
                                                var28 = new Buffer(new byte[1000]);

                                                while(true) {
                                                   int var64 = var63.read(var28.array, var28.offset, 1000 - var28.offset);
                                                   if(var64 == -1) {
                                                      var55.close();
                                                      var63.close();
                                                      String var34 = new String(var28.array);
                                                      if(var34.startsWith("OFFLINE")) {
                                                         var65 = 4;
                                                      } else if(var34.startsWith("WRONG")) {
                                                         var65 = 7;
                                                      } else if(var34.startsWith("RELOAD")) {
                                                         var65 = 3;
                                                      } else if(var34.startsWith("Not permitted for social network accounts.")) {
                                                         var65 = 6;
                                                      } else {
                                                         var28.xteaDecryptAll_base(var25);

                                                         while(var28.offset > 0 && var28.array[var28.offset - 1] == 0) {
                                                            --var28.offset;
                                                         }

                                                         var34 = new String(var28.array, 0, var28.offset);
                                                         boolean var35;
                                                         if(var34 == null) {
                                                            var35 = false;
                                                         } else {
                                                            label1948: {
                                                               try {
                                                                  new URL(var34);
                                                               } catch (MalformedURLException var71) {
                                                                  var35 = false;
                                                                  break label1948;
                                                               }

                                                               var35 = true;
                                                            }
                                                         }

                                                         if(var35) {
                                                            HealthBar.openURL_base(var34, true, false);
                                                            var65 = 2;
                                                         } else {
                                                            var65 = 5;
                                                         }
                                                      }
                                                      break;
                                                   }

                                                   var28.offset += var64;
                                                   if(var28.offset >= 1000) {
                                                      var65 = 5;
                                                      break;
                                                   }
                                                }
                                             } catch (Throwable var72) {
                                                var72.printStackTrace();
                                                var65 = 5;
                                             }

                                             var86 = var65;
                                          }

                                          switch(var86) {
                                          case 2:
                                             class139.setLoginResponseString_base(Strings.field4189, Strings.field4118, Strings.field4191);
                                             UserComparator7.method2966_base(6);
                                             break;
                                          case 3:
                                             class139.setLoginResponseString_base("", "Error connecting to server.", "");
                                             break;
                                          case 4:
                                             class139.setLoginResponseString_base("The part of the website you are trying", "to connect to is offline at the moment.", "Please try again later.");
                                             break;
                                          case 5:
                                             class139.setLoginResponseString_base("Sorry, there was an error trying to", "log you in to this part of the website.", "Please try again later.");
                                             break;
                                          case 6:
                                             class139.setLoginResponseString_base("", "Error connecting to server.", "");
                                             break;
                                          case 7:
                                             class139.setLoginResponseString_base("You must enter a valid login to proceed. For accounts", "created after 24th November 2010, please use your", "email address. Otherwise please use your username.");
                                          }
                                       }

                                       return;
                                    }

                                    if(var85 && Login.Login_username.length() < 320) {
                                       Login.Login_username = Login.Login_username + var41.field2363;
                                       Client.onUsernameChanged(-1);
                                    }
                                 }
                              }
                           } else if(Login.loginIndex != 6) {
                              if(Login.loginIndex == 7) {
                                 if(PendingSpawn.field1169 && !Client.onMobile) {
                                    var11 = class157.loginBoxCenter - 150;
                                    var83 = var11 + 40 + 240 + 25;
                                    var82 = 231;
                                    var14 = var82 + 40;
                                    if(var6 == 1 && var78 >= var11 && var78 <= var83 && var79 >= var82 && var79 <= var14) {
                                       Login.field915 = ObjectSound.method1978_base(var11, var78);
                                    }

                                    var15 = Login.loginBoxX + 180 - 80;
                                    short var16 = 321;
                                    boolean var66;
                                    if(var6 == 1 && var78 >= var15 - 75 && var78 <= var15 + 75 && var79 >= var16 - 20 && var79 <= var16 + 20) {
                                       var66 = class36.method709_base();
                                       if(var66) {
                                          WorldMapSection2.updateGameState_base(50);
                                          return;
                                       }
                                    }

                                    var15 = Login.loginBoxX + 180 + 80;
                                    if(var6 == 1 && var78 >= var15 - 75 && var78 <= var15 + 75 && var79 >= var16 - 20 && var79 <= var16 + 20) {
                                       Login.field907 = new String[8];
                                       SoundSystem.Login_promptCredentials_base(true);
                                    }

                                    while(var41.method4324_base()) {
                                       if(var41.field2360 == 101) {
                                          Login.field907[Login.field915] = null;
                                       }

                                       if(var41.field2360 == 85) {
                                          if(Login.field907[Login.field915] == null && Login.field915 > 0) {
                                             --Login.field915;
                                          }

                                          Login.field907[Login.field915] = null;
                                       }

                                       if(var41.field2363 >= '0' && var41.field2363 <= '9') {
                                          Login.field907[Login.field915] = "" + var41.field2363;
                                          if(Login.field915 < 7) {
                                             ++Login.field915;
                                          }
                                       }

                                       if(var41.field2360 == 84) {
                                          var66 = class36.method709_base();
                                          if(var66) {
                                             WorldMapSection2.updateGameState_base(50);
                                          }

                                          return;
                                       }
                                    }
                                 } else {
                                    var11 = Login.loginBoxX + 180 - 80;
                                    var12 = 321;
                                    if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                       HealthBar.openURL_base(WorldMapID.method4938_base("secure", true) + "m=dob/set_dob.ws", true, false);
                                       class139.setLoginResponseString_base("", "Page has opened in the browser.", "");
                                       UserComparator7.method2966_base(6);
                                       return;
                                    }

                                    var11 = Login.loginBoxX + 180 + 80;
                                    if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                       SoundSystem.Login_promptCredentials_base(true);
                                    }
                                 }
                              } else if(Login.loginIndex == 8) {
                                 var11 = Login.loginBoxX + 180 - 80;
                                 var12 = 321;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                                    class139.setLoginResponseString_base("", "Page has opened in the browser.", "");
                                    UserComparator7.method2966_base(6);
                                    return;
                                 }

                                 var11 = Login.loginBoxX + 180 + 80;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    SoundSystem.Login_promptCredentials_base(true);
                                 }
                              } else if(Login.loginIndex == 9) {
                                 var11 = Login.loginBoxX + 180;
                                 var12 = 311;
                                 if(var9.field2360 == 84 || var9.field2360 == 13 || var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    ClientPreferences.method2645_base(false);
                                 }
                              } else if(Login.loginIndex == 10) {
                                 var11 = Login.loginBoxX + 180;
                                 var12 = 209;
                                 if(var9.field2360 == 84 || var6 == 1 && var78 >= var11 - 109 && var78 <= var11 + 109 && var79 >= var12 && var79 <= var12 + 68) {
                                    class139.setLoginResponseString_base("", "Connecting to server...", "");
                                    Client.field526 = class531.field5192;
                                    VerticalAlignment.method3754_base(false);
                                    WorldMapSection2.updateGameState_base(20);
                                 }
                              } else if(Login.loginIndex == 12) {
                                 var11 = class157.loginBoxCenter;
                                 var12 = 233;
                                 var44 = var2.method7670(0, 30, "<col=ffd200>terms of use</col>, <col=ffd200>privacy policy</col>, and <col=ffd200>end user licence</col>", var11, var12);
                                 Bounds var42 = var2.method7670(32, 32, "<col=ffd200>terms of use</col>, <col=ffd200>privacy policy</col>, and <col=ffd200>end user licence</col>", var11, var12);
                                 Bounds var43 = var2.method7670(70, 34, "<col=ffd200>terms of use</col>, <col=ffd200>privacy policy</col>, and <col=ffd200>end user licence</col>", var11, var12);
                                 var83 = var12 + 17;
                                 Bounds var105 = var2.method7670(0, 34, "<col=ffd200>agreement (EULA)</col>.", var11, var83);
                                 if(var6 == 1) {
                                    if(var44.method8373_base(var78, var79)) {
                                       HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                                    } else if(var42.method8373_base(var78, var79)) {
                                       HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                                    } else if(var43.method8373_base(var78, var79) || var105.method8373_base(var78, var79)) {
                                       HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                                    }
                                 }

                                 var11 = class157.loginBoxCenter - 80;
                                 var12 = 311;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    WorldMapIcon_1.clientPreferences.method2561_base(Client.field488);
                                    ClientPreferences.method2645_base(true);
                                 }

                                 var11 = class157.loginBoxCenter + 80;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    Login.loginIndex = 13;
                                 }
                              } else if(Login.loginIndex == 13) {
                                 var11 = class157.loginBoxCenter;
                                 var12 = 321;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    ClientPreferences.method2645_base(true);
                                 }
                              } else if(Login.loginIndex == 14) {
                                 String var67 = "";
                                 switch(Login.Login_banType) {
                                 case 0:
                                    var67 = "https://discord.gg/wWz8AHZRFg";
                                    break;
                                 case 1:
                                    var67 = "https://discord.gg/wWz8AHZRFg";
                                    break;
                                 case 2:
                                    var67 = "https://discord.gg/wWz8AHZRFg";
                                    break;
                                 default:
                                    SoundSystem.Login_promptCredentials_base(false);
                                 }

                                 var83 = Login.loginBoxX + 180;
                                 var82 = 276;
                                 if(var6 == 1 && var78 >= var83 - 75 && var78 <= var83 + 75 && var79 >= var82 - 20 && var79 <= var82 + 20) {
                                    HealthBar.openURL_base(var67, true, false);
                                    class139.setLoginResponseString_base("", "Page has opened in the browser.", "");
                                    UserComparator7.method2966_base(6);
                                    return;
                                 }

                                 var83 = Login.loginBoxX + 180;
                                 var82 = 326;
                                 if(var6 == 1 && var78 >= var83 - 75 && var78 <= var83 + 75 && var79 >= var82 - 20 && var79 <= var82 + 20) {
                                    SoundSystem.Login_promptCredentials_base(false);
                                 }
                              } else if(Login.loginIndex == 24) {
                                 var11 = Login.loginBoxX + 180;
                                 var12 = 301;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    ClientPreferences.method2645_base(false);
                                 }
                              } else if(Login.loginIndex == 32) {
                                 var11 = Login.loginBoxX + 180 - 80;
                                 var12 = 321;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    HealthBar.openURL_base(WorldMapID.method4938_base("secure", true) + "m=dob/set_dob.ws", true, false);
                                    class139.setLoginResponseString_base("", "Page has opened in the browser.", "");
                                    UserComparator7.method2966_base(6);
                                    return;
                                 }

                                 var11 = Login.loginBoxX + 180 + 80;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    SoundSystem.Login_promptCredentials_base(true);
                                 }
                              } else if(Login.loginIndex == 33) {
                                 var11 = Login.loginBoxX + 180;
                                 var12 = 276;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    HealthBar.openURL_base("https://discord.gg/wWz8AHZRFg", true, false);
                                 }

                                 var11 = Login.loginBoxX + 180;
                                 var12 = 326;
                                 if(var6 == 1 && var78 >= var11 - 75 && var78 <= var11 + 75 && var79 >= var12 - 20 && var79 <= var12 + 20) {
                                    SoundSystem.Login_promptCredentials_base(true);
                                 }
                              }
                           } else {
                              while(true) {
                                 do {
                                    if(!var41.method4324_base()) {
                                       var81 = 321;
                                       if(var6 == 1 && var79 >= var81 - 20 && var79 <= var81 + 20) {
                                          SoundSystem.Login_promptCredentials_base(true);
                                       }

                                       return;
                                    }
                                 } while(var41.field2360 != 84 && var41.field2360 != 13);

                                 SoundSystem.Login_promptCredentials_base(true);
                              }
                           }
                        }
                     }
                  }
               }

            }
         }
      }
   }

   @ObfuscatedName("bg")
   @ObfuscatedSignature(
      descriptor = "(ILdt;ZI)I",
      garbageValue = "-983398043"
   )
   static int method2495(int var0, Script var1, boolean var2) {
      int var3;
      if(var0 == 3903) {
         var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
         Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = Client.grandExchangeOffers[var3].type_base();
         return 1;
      } else if(var0 == 3904) {
         var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
         Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = Client.grandExchangeOffers[var3].id;
         return 1;
      } else if(var0 == 3905) {
         var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
         Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = Client.grandExchangeOffers[var3].unitPrice;
         return 1;
      } else if(var0 == 3906) {
         var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
         Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = Client.grandExchangeOffers[var3].totalQuantity;
         return 1;
      } else if(var0 == 3907) {
         var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
         Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = Client.grandExchangeOffers[var3].currentQuantity;
         return 1;
      } else if(var0 == 3908) {
         var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
         Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = Client.grandExchangeOffers[var3].currentPrice;
         return 1;
      } else {
         int var12;
         if(var0 == 3910) {
            var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
            var12 = Client.grandExchangeOffers[var3].status_base();
            Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = var12 == 0?1:0;
            return 1;
         } else if(var0 == 3911) {
            var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
            var12 = Client.grandExchangeOffers[var3].status_base();
            Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = var12 == 2?1:0;
            return 1;
         } else if(var0 == 3912) {
            var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
            var12 = Client.grandExchangeOffers[var3].status_base();
            Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = var12 == 5?1:0;
            return 1;
         } else if(var0 == 3913) {
            var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
            var12 = Client.grandExchangeOffers[var3].status_base();
            Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = var12 == 1?1:0;
            return 1;
         } else {
            boolean var13;
            if(var0 == 3914) {
               var13 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize] == 1;
               if(class6.grandExchangeEvents != null) {
                  class6.grandExchangeEvents.sort_base(GrandExchangeEvents.GrandExchangeEvents_nameComparator, var13);
               }

               return 1;
            } else if(var0 == 3915) {
               var13 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize] == 1;
               if(class6.grandExchangeEvents != null) {
                  class6.grandExchangeEvents.sort_base(GrandExchangeEvents.GrandExchangeEvents_priceComparator, var13);
               }

               return 1;
            } else if(var0 == 3916) {
               DbTableType.Interpreter_intStackSize -= 2;
               var13 = Interpreter.Interpreter_intStack[DbTableType.Interpreter_intStackSize] == 1;
               boolean var4 = Interpreter.Interpreter_intStack[DbTableType.Interpreter_intStackSize + 1] == 1;
               if(class6.grandExchangeEvents != null) {
                  Client.GrandExchangeEvents_worldComparator.filterWorlds = var4;
                  class6.grandExchangeEvents.sort_base(Client.GrandExchangeEvents_worldComparator, var13);
               }

               return 1;
            } else if(var0 == 3917) {
               var13 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize] == 1;
               if(class6.grandExchangeEvents != null) {
                  class6.grandExchangeEvents.sort_base(GrandExchangeEvents.GrandExchangeEvents_ageComparator, var13);
               }

               return 1;
            } else if(var0 == 3918) {
               var13 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize] == 1;
               if(class6.grandExchangeEvents != null) {
                  class6.grandExchangeEvents.sort_base(GrandExchangeEvents.GrandExchangeEvents_quantityComparator, var13);
               }

               return 1;
            } else if(var0 == 3919) {
               Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = class6.grandExchangeEvents == null?0:class6.grandExchangeEvents.events.size();
               return 1;
            } else {
               GrandExchangeEvent var11;
               if(var0 == 3920) {
                  var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
                  var11 = (GrandExchangeEvent)class6.grandExchangeEvents.events.get(var3);
                  Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = var11.world;
                  return 1;
               } else if(var0 == 3921) {
                  var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
                  var11 = (GrandExchangeEvent)class6.grandExchangeEvents.events.get(var3);
                  Interpreter.Interpreter_stringStack[++class127.Interpreter_stringStackSize - 1] = var11.getOfferName_base();
                  return 1;
               } else if(var0 == 3922) {
                  var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
                  var11 = (GrandExchangeEvent)class6.grandExchangeEvents.events.get(var3);
                  Interpreter.Interpreter_stringStack[++class127.Interpreter_stringStackSize - 1] = var11.getPreviousOfferName_base();
                  return 1;
               } else if(var0 == 3923) {
                  var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
                  var11 = (GrandExchangeEvent)class6.grandExchangeEvents.events.get(var3);
                  long var5 = SpotAnimationDefinition.method3775_base() - class489.field4905 - var11.age;
                  int var7 = (int)(var5 / 3600000L);
                  int var8 = (int)((var5 - (long)(var7 * 3600000)) / 60000L);
                  int var9 = (int)((var5 - (long)(var7 * 3600000) - (long)(var8 * 60000)) / 1000L);
                  String var10 = var7 + ":" + var8 / 10 + var8 % 10 + ":" + var9 / 10 + var9 % 10;
                  Interpreter.Interpreter_stringStack[++class127.Interpreter_stringStackSize - 1] = var10;
                  return 1;
               } else if(var0 == 3924) {
                  var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
                  var11 = (GrandExchangeEvent)class6.grandExchangeEvents.events.get(var3);
                  Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = var11.grandExchangeOffer.totalQuantity;
                  return 1;
               } else if(var0 == 3925) {
                  var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
                  var11 = (GrandExchangeEvent)class6.grandExchangeEvents.events.get(var3);
                  Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = var11.grandExchangeOffer.unitPrice;
                  return 1;
               } else if(var0 == 3926) {
                  var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
                  var11 = (GrandExchangeEvent)class6.grandExchangeEvents.events.get(var3);
                  Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = var11.grandExchangeOffer.id;
                  return 1;
               } else if(var0 == 3939) {
                  var3 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
                  Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = class214.method4226(var3).isTradable?1:0;
                  return 1;
               } else {
                  return 2;
               }
            }
         }
      }
   }

   public int getPoseAnimationFrame() {
      return this.movementFrame;
   }

   public void setPoseAnimationFrame(int var1) {
      this.movementFrame = var1;
   }
}
