package mapped;

import java.util.Arrays;
import java.util.concurrent.Future;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;

@ObfuscatedName("aq")
public class class18 {
   @ObfuscatedName("ak")
   @ObfuscatedGetter(
      intValue = -1288987617
   )
   static int field88;
   @ObfuscatedName("kq")
   @ObfuscatedGetter(
      intValue = -125616841
   )
   static int field85;
   @ObfuscatedName("at")
   Future field86;
   @ObfuscatedName("ah")
   String field84;

   class18(Future var1) {
      this.field86 = var1;
   }

   class18(String var1) {
      this.method265_base(var1);
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(Ljava/lang/String;I)V",
      garbageValue = "-556763021"
   )
   void method265_base(String var1) {
      if(var1 == null) {
         var1 = "";
      }

      this.field84 = var1;
      if(this.field86 != null) {
         this.field86.cancel(true);
         this.field86 = null;
      }

   }

   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "(B)Ljava/lang/String;",
      garbageValue = "94"
   )
   public final String method264_base() {
      return this.field84;
   }

   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "(I)Z",
      garbageValue = "-712544099"
   )
   public boolean method267_base() {
      return this.field84 != null || this.field86 == null;
   }

   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "(B)Z",
      garbageValue = "66"
   )
   public final boolean method283_base() {
      return this.method267_base()?true:this.field86.isDone();
   }

   @ObfuscatedName("ab")
   @ObfuscatedSignature(
      descriptor = "(B)Law;",
      garbageValue = "-42"
   )
   public final class20 method269_base() {
      if(this.method267_base()) {
         return new class20(this.field84);
      } else if(!this.method283_base()) {
         return null;
      } else {
         class20 var10000;
         try {
            var10000 = (class20)this.field86.get();
         } catch (Exception var3) {
            String var2 = "Error retrieving REST request reply";
            System.err.println(var2 + "\r\n" + var3);
            this.method265_base(var2);
            return new class20(var2);
         }

         return var10000;
      }
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(Lol;I)V",
      garbageValue = "1722301374"
   )
   public static void method288(AbstractArchive var0) {
      StructComposition.StructDefinition_archive = var0;
   }

   @ObfuscatedName("by")
   @ObfuscatedSignature(
      descriptor = "(Lnn;Lnb;ZI)V",
      garbageValue = "-342367783"
   )
   public static void method290(Widget var0, PlayerComposition var1, boolean var2) {
      var0.modelType = 7;
      var0.field3717 = new PlayerComposition(var1);
      if(!var2) {
         var0.field3717.equipment = Arrays.copyOf(var0.field3717.field3596, var0.field3717.field3596.length);
         var0.field3717.method6323_base();
      }

   }

   @ObfuscatedName("id")
   @ObfuscatedSignature(
      descriptor = "(Lnn;III)V",
      garbageValue = "-1252967897"
   )
   static final void method291(Widget var0, int var1, int var2) {
      if(Client.rl$minimapReceivesClicks) {
         Client.copy$checkIfMinimapClicked(var0, var1, var2, -1252967897);
      }
   }

   @ObfuscatedName("jo")
   @ObfuscatedSignature(
      descriptor = "(ZI)V",
      garbageValue = "-805283190"
   )
   static final void addNpcsToScene_base(boolean var0) {
      for(int var1 = 0; var1 < Client.npcCount; ++var1) {
         NPC var2 = Client.npcs[Client.npcIndices[var1]];
         if(var2 != null && var2.isVisible_base() && var2.definition.isVisible == var0 && var2.definition.transformIsVisible_base()) {
            int var3 = var2.x >> 7;
            int var4 = var2.y >> 7;
            if(var3 >= 0 && var3 < 104 && var4 >= 0 && var4 < 104) {
               if(var2.field1198 == 1 && (var2.x & 127) == 64 && (var2.y & 127) == 64) {
                  if(Client.tileLastDrawnActor[var3][var4] == Client.viewportDrawCount) {
                     continue;
                  }

                  Client.tileLastDrawnActor[var3][var4] = Client.viewportDrawCount;
               }

               long var5 = Player.calculateTag_base(0, 0, 1, !var2.definition.isInteractable, Client.npcIndices[var1]);
               var2.playerCycle = Client.cycle;
               class36.scene.method5444(ItemLayer.Client_plane, var2.x, var2.y, WorldMapDecorationType.getTileHeight_base(var2.field1198 * 64 - 64 + var2.x, var2.field1198 * 64 - 64 + var2.y, ItemLayer.Client_plane), var2.field1198 * 64 - 64 + 60, var2, var2.rotation, var5, var2.isWalking);
            }
         }
      }

   }
}
