package mapped;

import net.runelite.api.IterableHashTable;
import net.runelite.api.ParamHolder;
import net.runelite.api.events.PostObjectComposition;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSBuffer;
import net.runelite.rs.api.RSEvictingDualNodeHashTable;
import net.runelite.rs.api.RSIntegerNode;
import net.runelite.rs.api.RSIterableNodeHashTable;
import net.runelite.rs.api.RSNode;
import net.runelite.rs.api.RSObjectComposition;
import net.runelite.rs.api.RSObjectNode;
import net.runelite.rs.api.RSParamComposition;

@ObfuscatedName("hs")
public class ObjectComposition extends DualNode implements RSObjectComposition, ParamHolder {
   @ObfuscatedName("at")
   static boolean ObjectDefinition_isLowDetail;
   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "Lol;"
   )
   static AbstractArchive ObjectDefinition_archive;
   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "Lol;"
   )
   static AbstractArchive ObjectDefinition_modelsArchive;
   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   static EvictingDualNodeHashTable ObjectDefinition_cached;
   @ObfuscatedName("ab")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   public static EvictingDualNodeHashTable ObjectDefinition_cachedModelData;
   @ObfuscatedName("au")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   static EvictingDualNodeHashTable ObjectDefinition_cachedEntities;
   @ObfuscatedName("aa")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   static EvictingDualNodeHashTable ObjectDefinition_cachedModels;
   @ObfuscatedName("ac")
   @ObfuscatedSignature(
      descriptor = "[Lkq;"
   )
   static ModelData[] modelDataArray;
   @ObfuscatedName("go")
   static String refreshToken;
   @ObfuscatedName("al")
   @ObfuscatedGetter(
      intValue = -1136432127
   )
   public int id;
   @ObfuscatedName("az")
   int[] modelIds;
   @ObfuscatedName("ap")
   int[] models;
   @ObfuscatedName("av")
   public String name;
   @ObfuscatedName("ax")
   short[] recolorFrom;
   @ObfuscatedName("as")
   short[] recolorTo;
   @ObfuscatedName("ay")
   short[] retextureFrom;
   @ObfuscatedName("ak")
   short[] retextureTo;
   @ObfuscatedName("aj")
   @ObfuscatedGetter(
      intValue = -4426149
   )
   public int sizeX;
   @ObfuscatedName("am")
   @ObfuscatedGetter(
      intValue = 1204643739
   )
   public int sizeY;
   @ObfuscatedName("aq")
   @ObfuscatedGetter(
      intValue = 606535565
   )
   public int interactType;
   @ObfuscatedName("ai")
   public boolean boolean1;
   @ObfuscatedName("aw")
   @ObfuscatedGetter(
      intValue = 1627307883
   )
   public int int1;
   @ObfuscatedName("ae")
   @ObfuscatedGetter(
      intValue = 332277929
   )
   int clipType;
   @ObfuscatedName("an")
   boolean nonFlatShading;
   @ObfuscatedName("ag")
   public boolean modelClipped;
   @ObfuscatedName("ad")
   @ObfuscatedGetter(
      intValue = -1341489307
   )
   public int animationId;
   @ObfuscatedName("af")
   @ObfuscatedGetter(
      intValue = -1021782423
   )
   public int int2;
   @ObfuscatedName("be")
   @ObfuscatedGetter(
      intValue = -1618267977
   )
   int ambient;
   @ObfuscatedName("bd")
   @ObfuscatedGetter(
      intValue = -1275296293
   )
   int contrast;
   @ObfuscatedName("bl")
   public String[] actions;
   @ObfuscatedName("bi")
   @ObfuscatedGetter(
      intValue = 1613863983
   )
   public int mapIconId;
   @ObfuscatedName("bv")
   @ObfuscatedGetter(
      intValue = -1993004129
   )
   public int mapSceneId;
   @ObfuscatedName("bf")
   boolean isRotated;
   @ObfuscatedName("bg")
   public boolean clipped;
   @ObfuscatedName("ba")
   @ObfuscatedGetter(
      intValue = 1680942827
   )
   int modelSizeX;
   @ObfuscatedName("bm")
   @ObfuscatedGetter(
      intValue = 1228566015
   )
   int modelHeight;
   @ObfuscatedName("bp")
   @ObfuscatedGetter(
      intValue = 1594866813
   )
   int modelSizeY;
   @ObfuscatedName("bw")
   @ObfuscatedGetter(
      intValue = 615586201
   )
   int offsetX;
   @ObfuscatedName("bj")
   @ObfuscatedGetter(
      intValue = 361473055
   )
   int offsetHeight;
   @ObfuscatedName("bn")
   @ObfuscatedGetter(
      intValue = 1432480799
   )
   int offsetY;
   @ObfuscatedName("bo")
   public boolean boolean2;
   @ObfuscatedName("bt")
   boolean isSolid;
   @ObfuscatedName("bu")
   @ObfuscatedGetter(
      intValue = -94680451
   )
   public int int3;
   @ObfuscatedName("by")
   public int[] transforms;
   @ObfuscatedName("bh")
   @ObfuscatedGetter(
      intValue = 2118709479
   )
   int transformVarbit;
   @ObfuscatedName("bz")
   @ObfuscatedGetter(
      intValue = -800140791
   )
   int transformVarp;
   @ObfuscatedName("bc")
   @ObfuscatedGetter(
      intValue = 1636690431
   )
   public int ambientSoundId;
   @ObfuscatedName("bs")
   @ObfuscatedGetter(
      intValue = 1720962395
   )
   public int int7;
   @ObfuscatedName("bx")
   @ObfuscatedGetter(
      intValue = -2080815669
   )
   public int int5;
   @ObfuscatedName("bb")
   @ObfuscatedGetter(
      intValue = 649649503
   )
   public int int6;
   @ObfuscatedName("bk")
   public int[] soundEffectIds;
   @ObfuscatedName("br")
   public boolean boolean3;
   @ObfuscatedName("bq")
   @ObfuscatedSignature(
      descriptor = "Ltz;"
   )
   IterableNodeHashTable params;
   public int accessBitMask;

   static {
      ObjectDefinition_isLowDetail = false;
      ObjectDefinition_cached = new EvictingDualNodeHashTable(4096);
      ObjectDefinition_cachedModelData = new EvictingDualNodeHashTable(500);
      ObjectDefinition_cachedEntities = new EvictingDualNodeHashTable(30);
      ObjectDefinition_cachedModels = new EvictingDualNodeHashTable(30);
      modelDataArray = new ModelData[4];
      rl$clinit();
   }

   ObjectComposition() {
      this.name = "null";
      this.sizeX = 1;
      this.sizeY = 1;
      this.interactType = 2;
      this.boolean1 = true;
      this.int1 = -1;
      this.clipType = -1;
      this.nonFlatShading = false;
      this.modelClipped = false;
      this.animationId = -1;
      this.int2 = 16;
      this.ambient = 0;
      this.contrast = 0;
      this.actions = new String[5];
      this.mapIconId = -1;
      this.mapSceneId = -1;
      this.isRotated = false;
      this.clipped = true;
      this.modelSizeX = 128;
      this.modelHeight = 128;
      this.modelSizeY = 128;
      this.offsetX = 0;
      this.offsetHeight = 0;
      this.offsetY = 0;
      this.boolean2 = false;
      this.isSolid = false;
      this.int3 = -1;
      this.transformVarbit = -1;
      this.transformVarp = -1;
      this.ambientSoundId = -1;
      this.int7 = 0;
      this.int5 = 0;
      this.int6 = 0;
      this.boolean3 = true;
      this.rl$$init();
   }

   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "(S)V",
      garbageValue = "-9893"
   )
   void postDecode_base() {
      if(this.int1 == -1) {
         this.int1 = 0;
         if(this.modelIds != null && (this.models == null || this.models[0] == 10)) {
            this.int1 = 1;
         }

         for(int var1 = 0; var1 < 5; ++var1) {
            if(this.actions[var1] != null) {
               this.int1 = 1;
            }
         }
      }

      if(this.int3 == -1) {
         this.int3 = this.interactType != 0?1:0;
      }

      this.postDecode();
   }

   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "(Luj;B)V",
      garbageValue = "-11"
   )
   void method3891(Buffer var1) {
      while(true) {
         int var2 = var1.readUnsignedByte_base();
         if(var2 == 0) {
            return;
         }

         this.method3911(var1, var2);
      }
   }

   @ObfuscatedName("ab")
   @ObfuscatedSignature(
      descriptor = "(Luj;II)V",
      garbageValue = "1972303486"
   )
   void method3911(Buffer var1, int var2) {
      int var3;
      int var4;
      if(var2 == 1) {
         var3 = var1.readUnsignedByte();
         if(var3 > 0) {
            if(this.getModelIds() != null && !this.getObjectDefinitionIsLowDetail()) {
               var1.setOffset(var1.getOffset() + 3 * var3);
            } else {
               this.setModels(new int[var3]);
               this.setModelIds(new int[var3]);

               for(var4 = 0; var4 < var3; ++var4) {
                  this.getModelIds()[var4] = var1.readUnsignedShort();
                  this.getModels()[var4] = var1.readUnsignedByte();
               }
            }
         }
      } else if(var2 == 2) {
         this.setName(var1.readStringCp1252NullTerminated());
      } else if(var2 == 5) {
         var3 = var1.readUnsignedByte();
         if(var3 > 0) {
            if(this.getModelIds() != null && !this.getObjectDefinitionIsLowDetail()) {
               var1.setOffset(var1.getOffset() + var3 * 2);
            } else {
               this.setModels((int[])null);
               this.setModelIds(new int[var3]);

               for(var4 = 0; var4 < var3; ++var4) {
                  this.getModelIds()[var4] = var1.readUnsignedShort();
               }
            }
         }
      } else if(var2 == 14) {
         this.setSizeX(var1.readUnsignedByte());
      } else if(var2 == 15) {
         this.setSizeY(var1.readUnsignedByte());
      } else if(var2 == 17) {
         this.setInteractType(0);
         this.setBoolean1(false);
      } else if(var2 == 18) {
         this.setBoolean1(false);
      } else if(var2 == 19) {
         this.setInt1(var1.readUnsignedByte());
      } else if(var2 == 21) {
         this.setClipType(0);
      } else if(var2 == 22) {
         this.setNonFlatShading(true);
      } else if(var2 == 23) {
         this.setModelClipped(true);
      } else if(var2 == 24) {
         this.setAnimationId(var1.readUnsignedShort());
         if(this.getAnimationId() == 65535) {
            this.setAnimationId(-1);
         }
      } else if(var2 == 27) {
         this.setInteractType(1);
      } else if(var2 == 28) {
         this.setInt2(var1.readUnsignedByte());
      } else if(var2 == 29) {
         this.setAmbient(var1.readByte());
      } else if(var2 == 39) {
         this.setContrast(var1.readByte() * 25);
      } else if(var2 >= 30 && var2 < 35) {
         this.getActions()[var2 - 30] = var1.readStringCp1252NullTerminated();
         if(this.getActions()[var2 - 30].equalsIgnoreCase("Hidden")) {
            this.getActions()[var2 - 30] = null;
         }
      } else if(var2 == 40) {
         var3 = var1.readUnsignedByte();
         this.setRecolorFrom(new short[var3]);
         this.setRecolorTo(new short[var3]);

         for(var4 = 0; var4 < var3; ++var4) {
            this.getRecolorFrom()[var4] = (short)var1.readUnsignedShort();
            this.getRecolorTo()[var4] = (short)var1.readUnsignedShort();
         }
      } else if(var2 == 41) {
         var3 = var1.readUnsignedByte();
         this.setRetextureFrom(new short[var3]);
         this.setRetextureTo(new short[var3]);

         for(var4 = 0; var4 < var3; ++var4) {
            this.getRetextureFrom()[var4] = (short)var1.readUnsignedShort();
            this.getRetextureTo()[var4] = (short)var1.readUnsignedShort();
         }
      } else if(var2 == 61) {
         var1.readUnsignedShort();
      } else if(var2 == 62) {
         this.setIsRotated(true);
      } else if(var2 == 64) {
         this.setClipped(false);
      } else if(var2 == 65) {
         this.setModelSizeX(var1.readUnsignedShort());
      } else if(var2 == 66) {
         this.setModelHeight(var1.readUnsignedShort());
      } else if(var2 == 67) {
         this.setModelSizeY(var1.readUnsignedShort());
      } else if(var2 == 68) {
         this.setMapSceneId(var1.readUnsignedShort());
      } else if(var2 == 69) {
         this.accessBitMask = var1.readUnsignedByte();
      } else if(var2 == 70) {
         this.setOffsetX(var1.readShort());
      } else if(var2 == 71) {
         this.setOffsetHeight(var1.readShort());
      } else if(var2 == 72) {
         this.setOffsetY(var1.readShort());
      } else if(var2 == 73) {
         this.setBoolean2(true);
      } else if(var2 == 74) {
         this.setIsSolid(true);
      } else if(var2 == 75) {
         this.setInt3(var1.readUnsignedByte());
      } else if(var2 != 77 && var2 != 92) {
         if(var2 == 78) {
            this.setAmbientSoundId(var1.readUnsignedShort());
            this.setInt7(var1.readUnsignedByte());
         } else if(var2 == 79) {
            this.setInt5(var1.readUnsignedShort());
            this.setInt6(var1.readUnsignedShort());
            this.setInt7(var1.readUnsignedByte());
            var3 = var1.readUnsignedByte();
            this.setSoundEffectIds(new int[var3]);

            for(var4 = 0; var4 < var3; ++var4) {
               this.getSoundEffectIds()[var4] = var1.readUnsignedShort();
            }
         } else if(var2 == 81) {
            this.setClipType(var1.readUnsignedByte() * 256);
         } else if(var2 == 82) {
            this.setMapIconId(var1.readUnsignedShort());
         } else if(var2 == 89) {
            this.setBoolean3(false);
         } else if(var2 == 249) {
            this.setParams((IterableHashTable)SpriteMask.client.readStringIntParameters(var1, this.getParams()));
         }
      } else {
         this.setTransformVarbit(var1.readUnsignedShort());
         if(this.getTransformVarbit() == 65535) {
            this.setTransformVarbit(-1);
         }

         this.setTransformVarp(var1.readUnsignedShort());
         if(this.getTransformVarp() == 65535) {
            this.setTransformVarp(-1);
         }

         var3 = -1;
         if(var2 == 92) {
            var3 = var1.readUnsignedShort();
            if(var3 == 65535) {
               var3 = -1;
            }
         }

         var4 = var1.readUnsignedByte();
         this.setTransforms(new int[var4 + 2]);

         for(int var5 = 0; var5 <= var4; ++var5) {
            this.getTransforms()[var5] = var1.readUnsignedShort();
            if(this.getTransforms()[var5] == 65535) {
               this.getTransforms()[var5] = -1;
            }
         }

         this.getTransforms()[var4 + 1] = var3;
      }

   }

   @ObfuscatedName("au")
   @ObfuscatedSignature(
      descriptor = "(II)Z",
      garbageValue = "-813448886"
   )
   public final boolean method3892_base(int var1) {
      if(this.models != null) {
         for(int var4 = 0; var4 < this.models.length; ++var4) {
            if(this.models[var4] == var1) {
               return ObjectDefinition_modelsArchive.tryLoadFile_base(this.modelIds[var4] & 65535, 0);
            }
         }

         return true;
      } else if(this.modelIds == null) {
         return true;
      } else if(var1 != 10) {
         return true;
      } else {
         boolean var2 = true;

         for(int var3 = 0; var3 < this.modelIds.length; ++var3) {
            var2 &= ObjectDefinition_modelsArchive.tryLoadFile_base(this.modelIds[var3] & 65535, 0);
         }

         return var2;
      }
   }

   @ObfuscatedName("aa")
   @ObfuscatedSignature(
      descriptor = "(B)Z",
      garbageValue = "50"
   )
   public final boolean needsModelFiles_base() {
      if(this.modelIds == null) {
         return true;
      } else {
         boolean var1 = true;

         for(int var2 = 0; var2 < this.modelIds.length; ++var2) {
            var1 &= ObjectDefinition_modelsArchive.tryLoadFile_base(this.modelIds[var2] & 65535, 0);
         }

         return var1;
      }
   }

   @ObfuscatedName("ac")
   @ObfuscatedSignature(
      descriptor = "(II[[IIIII)Lkt;",
      garbageValue = "-484347663"
   )
   public final Renderable method3894(int var1, int var2, int[][] var3, int var4, int var5, int var6) {
      long var7;
      if(this.models == null) {
         var7 = (long)(var2 + (this.id << 10));
      } else {
         var7 = (long)(var2 + (var1 << 3) + (this.id << 10));
      }

      Object var9 = (Renderable)ObjectDefinition_cachedEntities.get(var7);
      if(var9 == null) {
         ModelData var10 = this.method3897(var1, var2);
         if(var10 == null) {
            return null;
         }

         if(!this.nonFlatShading) {
            var9 = var10.method5122(this.ambient + 64, this.contrast + 768, -50, -10, -50);
         } else {
            var10.ambient = (short)(this.ambient + 64);
            var10.contrast = (short)(this.contrast + 768);
            var10.calculateVertexNormals_base();
            var9 = var10;
         }

         ObjectDefinition_cachedEntities.put((DualNode)var9, var7);
      }

      if(this.nonFlatShading) {
         var9 = ((ModelData)var9).method5162();
      }

      if(this.clipType >= 0) {
         if(var9 instanceof Model) {
            var9 = ((Model)var9).method5562(var3, var4, var5, var6, true, this.clipType);
         } else if(var9 instanceof ModelData) {
            var9 = ((ModelData)var9).method5107(var3, var4, var5, var6, true, this.clipType);
         }
      }

      return (Renderable)var9;
   }

   @ObfuscatedName("al")
   @ObfuscatedSignature(
      descriptor = "(II[[IIIII)Lka;",
      garbageValue = "-593704599"
   )
   public final Model method3895(int var1, int var2, int[][] var3, int var4, int var5, int var6) {
      long var7;
      if(this.models == null) {
         var7 = (long)(var2 + (this.id << 10));
      } else {
         var7 = (long)(var2 + (var1 << 3) + (this.id << 10));
      }

      Model var9 = (Model)ObjectDefinition_cachedModels.get(var7);
      if(var9 == null) {
         ModelData var10 = this.method3897(var1, var2);
         if(var10 == null) {
            return null;
         }

         var9 = var10.method5122(this.ambient + 64, this.contrast + 768, -50, -10, -50);
         ObjectDefinition_cachedModels.put(var9, var7);
      }

      if(this.clipType >= 0) {
         var9 = var9.method5562(var3, var4, var5, var6, true, this.clipType);
      }

      return var9;
   }

   @ObfuscatedName("az")
   @ObfuscatedSignature(
      descriptor = "(II[[IIIILhx;IB)Lka;",
      garbageValue = "-49"
   )
   public final Model method3896(int var1, int var2, int[][] var3, int var4, int var5, int var6, SequenceDefinition var7, int var8) {
      long var9;
      if(this.models == null) {
         var9 = (long)(var2 + (this.id << 10));
      } else {
         var9 = (long)(var2 + (var1 << 3) + (this.id << 10));
      }

      Model var11 = (Model)ObjectDefinition_cachedModels.get(var9);
      if(var11 == null) {
         ModelData var12 = this.method3897(var1, var2);
         if(var12 == null) {
            return null;
         }

         var11 = var12.method5122(this.ambient + 64, this.contrast + 768, -50, -10, -50);
         ObjectDefinition_cachedModels.put(var11, var9);
      }

      if(var7 == null && this.clipType == -1) {
         return var11;
      } else {
         if(var7 != null) {
            var11 = var7.method4044(var11, var8, var2);
         } else {
            var11 = var11.method5563(true);
         }

         if(this.clipType >= 0) {
            var11 = var11.method5562(var3, var4, var5, var6, false, this.clipType);
         }

         return var11;
      }
   }

   @ObfuscatedName("ap")
   @ObfuscatedSignature(
      descriptor = "(III)Lkq;",
      garbageValue = "-1817742942"
   )
   final ModelData method3897(int var1, int var2) {
      ModelData var3 = null;
      boolean var4;
      int var5;
      int var7;
      if(this.models == null) {
         if(var1 != 10) {
            return null;
         }

         if(this.modelIds == null) {
            return null;
         }

         var4 = this.isRotated;
         if(var1 == 2 && var2 > 3) {
            var4 = !var4;
         }

         var5 = this.modelIds.length;

         for(int var6 = 0; var6 < var5; ++var6) {
            var7 = this.modelIds[var6];
            if(var4) {
               var7 += 65536;
            }

            var3 = (ModelData)ObjectDefinition_cachedModelData.get((long)var7);
            if(var3 == null) {
               var3 = ModelData.method5100(ObjectDefinition_modelsArchive, var7 & 65535, 0);
               if(var3 == null) {
                  return null;
               }

               if(var4) {
                  var3.method5167_base();
               }

               ObjectDefinition_cachedModelData.put(var3, (long)var7);
            }

            if(var5 > 1) {
               modelDataArray[var6] = var3;
            }
         }

         if(var5 > 1) {
            var3 = new ModelData(modelDataArray, var5);
         }
      } else {
         int var9 = -1;

         for(var5 = 0; var5 < this.models.length; ++var5) {
            if(this.models[var5] == var1) {
               var9 = var5;
               break;
            }
         }

         if(var9 == -1) {
            return null;
         }

         var5 = this.modelIds[var9];
         boolean var10 = this.isRotated ^ var2 > 3;
         if(var10) {
            var5 += 65536;
         }

         var3 = (ModelData)ObjectDefinition_cachedModelData.get((long)var5);
         if(var3 == null) {
            var3 = ModelData.method5100(ObjectDefinition_modelsArchive, var5 & 65535, 0);
            if(var3 == null) {
               return null;
            }

            if(var10) {
               var3.method5167_base();
            }

            ObjectDefinition_cachedModelData.put(var3, (long)var5);
         }
      }

      if(this.modelSizeX == 128 && this.modelHeight == 128 && this.modelSizeY == 128) {
         var4 = false;
      } else {
         var4 = true;
      }

      boolean var11;
      if(this.offsetX == 0 && this.offsetHeight == 0 && this.offsetY == 0) {
         var11 = false;
      } else {
         var11 = true;
      }

      ModelData var8 = new ModelData(var3, var2 == 0 && !var4 && !var11, this.recolorFrom == null, null == this.retextureFrom, true);
      if(var1 == 4 && var2 > 3) {
         var8.method5175_base(256);
         var8.changeOffset_base(45, 0, -45);
      }

      var2 &= 3;
      if(var2 == 1) {
         var8.method5109_base();
      } else if(var2 == 2) {
         var8.method5120_base();
      } else if(var2 == 3) {
         var8.method5111_base();
      }

      if(this.recolorFrom != null) {
         for(var7 = 0; var7 < this.recolorFrom.length; ++var7) {
            var8.recolor_base(this.recolorFrom[var7], this.recolorTo[var7]);
         }
      }

      if(this.retextureFrom != null) {
         for(var7 = 0; var7 < this.retextureFrom.length; ++var7) {
            var8.retexture_base(this.retextureFrom[var7], this.retextureTo[var7]);
         }
      }

      if(var4) {
         var8.resize_base(this.modelSizeX, this.modelHeight, this.modelSizeY);
      }

      if(var11) {
         var8.changeOffset_base(this.offsetX, this.offsetHeight, this.offsetY);
      }

      return var8;
   }

   @ObfuscatedName("av")
   @ObfuscatedSignature(
      descriptor = "(I)Lhs;",
      garbageValue = "611573830"
   )
   public final ObjectComposition method3907() {
      int var1 = -1;
      if(this.transformVarbit != -1) {
         var1 = HealthBar.getVarbit_base(this.transformVarbit);
      } else if(this.transformVarp != -1) {
         var1 = Varps.Varps_main[this.transformVarp];
      }

      int var2;
      if(var1 >= 0 && var1 < this.transforms.length - 1) {
         var2 = this.transforms[var1];
      } else {
         var2 = this.transforms[this.transforms.length - 1];
      }

      return var2 != -1?WorldMapSection2.method4515(var2):null;
   }

   @ObfuscatedName("ax")
   @ObfuscatedSignature(
      descriptor = "(III)I",
      garbageValue = "-2010138774"
   )
   public int getIntParam_base(int var1, int var2) {
      return Player.method2444(this.params, var1, var2);
   }

   @ObfuscatedName("as")
   @ObfuscatedSignature(
      descriptor = "(ILjava/lang/String;I)Ljava/lang/String;",
      garbageValue = "-2012679893"
   )
   public String getStringParam_base(int var1, String var2) {
      IterableNodeHashTable var4 = this.params;
      String var3;
      if(var4 == null) {
         var3 = var2;
      } else {
         ObjectNode var5 = (ObjectNode)var4.get((long)var1);
         if(var5 == null) {
            var3 = var2;
         } else {
            var3 = (String)var5.obj;
         }
      }

      return var3;
   }

   @ObfuscatedName("ak")
   @ObfuscatedSignature(
      descriptor = "(B)Z",
      garbageValue = "0"
   )
   public boolean hasSound_base() {
      if(this.transforms == null) {
         return this.ambientSoundId != -1 || this.soundEffectIds != null;
      } else {
         for(int var1 = 0; var1 < this.transforms.length; ++var1) {
            if(this.transforms[var1] != -1) {
               ObjectComposition var2 = WorldMapSection2.method4515(this.transforms[var1]);
               if(var2.ambientSoundId != -1 || var2.soundEffectIds != null) {
                  return true;
               }
            }
         }

         return false;
      }
   }

   public RSNode getParam(int var1) {
      return this.getParams() == null?null:(RSNode)this.getParams().get((long)var1);
   }

   public void setParam(int var1, RSNode var2) {
      RSParamComposition var3 = SpriteMask.client.getRSParamComposition(var1);
      if(var3.isString() != (var2 instanceof RSObjectNode)) {
         if(var3.isString()) {
            throw new IllegalArgumentException("trying to put int into string param");
         } else {
            throw new IllegalArgumentException("trying to put string into int param");
         }
      } else {
         if(this.getParams() == null) {
            this.setParams((IterableHashTable)SpriteMask.client.newIterableNodeHashTable(16));
         }

         this.getParams().put(var2, (long)var1);
      }
   }

   public void setName(String var1) {
      this.name = var1;
   }

   public int[] getModelIds() {
      return this.modelIds;
   }

   public void postDecode() {
      PostObjectComposition var1 = new PostObjectComposition(this);
      SpriteMask.client.getCallbacks().post(var1);
   }

   public void setSizeX(int var1) {
      this.sizeX = var1;
   }

   public void setSizeY(int var1) {
      this.sizeY = var1;
   }

   public boolean getObjectDefinitionIsLowDetail() {
      return ObjectDefinition_isLowDetail;
   }

   public void setInteractType(int var1) {
      this.interactType = var1;
   }

   public void setModels(int[] var1) {
      this.models = var1;
   }

   public void setBoolean1(boolean var1) {
      this.boolean1 = var1;
   }

   public void setParams(IterableHashTable var1) {
      this.params = (IterableNodeHashTable)var1;
   }

   public void setModelIds(int[] var1) {
      this.modelIds = var1;
   }

   public void setInt1(int var1) {
      this.int1 = var1;
   }

   public void setClipType(int var1) {
      this.clipType = var1;
   }

   public void setNonFlatShading(boolean var1) {
      this.nonFlatShading = var1;
   }

   public void setModelClipped(boolean var1) {
      this.modelClipped = var1;
   }

   public void setAnimationId(int var1) {
      this.animationId = var1;
   }

   public int getAnimationId() {
      return this.animationId;
   }

   public void setInt2(int var1) {
      this.int2 = var1;
   }

   public int[] getModels() {
      return this.models;
   }

   public void setAmbient(int var1) {
      this.ambient = var1;
   }

   public void setContrast(int var1) {
      this.contrast = var1;
   }

   public String[] getActions() {
      return this.actions;
   }

   public void setRecolorFrom(short[] var1) {
      this.recolorFrom = var1;
   }

   public void setRetextureFrom(short[] var1) {
      this.retextureFrom = var1;
   }

   public void setIsRotated(boolean var1) {
      this.isRotated = var1;
   }

   public void setRecolorTo(short[] var1) {
      this.recolorTo = var1;
   }

   public void setRetextureTo(short[] var1) {
      this.retextureTo = var1;
   }

   public void setClipped(boolean var1) {
      this.clipped = var1;
   }

   public void setModelSizeX(int var1) {
      this.modelSizeX = var1;
   }

   public short[] getRecolorFrom() {
      return this.recolorFrom;
   }

   public void setModelHeight(int var1) {
      this.modelHeight = var1;
   }

   public short[] getRetextureFrom() {
      return this.retextureFrom;
   }

   public void setModelSizeY(int var1) {
      this.modelSizeY = var1;
   }

   public void setMapSceneId(int var1) {
      this.mapSceneId = var1;
   }

   public short[] getRecolorTo() {
      return this.recolorTo;
   }

   public void setOffsetX(int var1) {
      this.offsetX = var1;
   }

   public short[] getRetextureTo() {
      return this.retextureTo;
   }

   public void setOffsetHeight(int var1) {
      this.offsetHeight = var1;
   }

   public void setOffsetY(int var1) {
      this.offsetY = var1;
   }

   public void setBoolean2(boolean var1) {
      this.boolean2 = var1;
   }

   public void setIsSolid(boolean var1) {
      this.isSolid = var1;
   }

   public void setInt3(int var1) {
      this.int3 = var1;
   }

   public void setTransformVarbit(int var1) {
      this.transformVarbit = var1;
   }

   public void setAmbientSoundId(int var1) {
      this.ambientSoundId = var1;
   }

   public int getTransformVarbit() {
      return this.transformVarbit;
   }

   public void setInt5(int var1) {
      this.int5 = var1;
   }

   public void setMapIconId(int var1) {
      this.mapIconId = var1;
   }

   public void setBoolean3(boolean var1) {
      this.boolean3 = var1;
   }

   public void setInt7(int var1) {
      this.int7 = var1 * -1636881280;
   }

   public void setInt6(int var1) {
      this.int6 = var1;
   }

   public void setTransformVarp(int var1) {
      this.transformVarp = var1;
   }

   public RSIterableNodeHashTable getParams() {
      return this.params;
   }

   public int getTransformVarp() {
      return this.transformVarp;
   }

   public void setSoundEffectIds(int[] var1) {
      this.soundEffectIds = var1;
   }

   public int[] getSoundEffectIds() {
      return this.soundEffectIds;
   }

   public void setTransforms(int[] var1) {
      this.transforms = var1;
   }

   public int[] getTransforms() {
      return this.transforms;
   }

   private void rl$$init() {
      this.accessBitMask = 0;
   }

   public int getIntValue(int var1) {
      RSNode var2 = this.getParam(var1);
      if(var2 != null) {
         RSIntegerNode var4 = (RSIntegerNode)var2;
         return var4.getValue();
      } else {
         RSParamComposition var3 = SpriteMask.client.getRSParamComposition(var1);
         if(var3.isString()) {
            throw new IllegalArgumentException("trying to get int from string param");
         } else {
            return var3.getDefaultInt();
         }
      }
   }

   public void setValue(int var1, int var2) {
      this.setParam(var1, SpriteMask.client.newIntegerNode(var2));
   }

   public String getStringValue(int var1) {
      RSNode var2 = this.getParam(var1);
      if(var2 != null) {
         RSObjectNode var4 = (RSObjectNode)var2;
         return (String)var4.getValue();
      } else {
         RSParamComposition var3 = SpriteMask.client.getRSParamComposition(var1);
         if(!var3.isString()) {
            throw new IllegalArgumentException("trying to get string from int param");
         } else {
            return var3.getDefaultStr();
         }
      }
   }

   public void setValue(int var1, String var2) {
      this.setParam(var1, SpriteMask.client.newObjectNode(var2));
   }

   @ObfuscatedSignature(
      descriptor = "(Luj;II)V"
   )
   public void copy$decodeNext(Buffer var1, int var2, int var3) {
      int var4;
      int var5;
      if(var2 == 1) {
         var4 = var1.readUnsignedByte_base();
         if(var4 > 0) {
            if(this.modelIds != null) {
               if(!ObjectDefinition_isLowDetail) {
                  var1.offset += var4 * 3;
                  return;
               }

               if(var3 <= 1840718348) {
                  return;
               }
            }

            this.models = new int[var4];
            this.modelIds = new int[var4];

            for(var5 = 0; var5 < var4; ++var5) {
               this.modelIds[var5] = var1.readUnsignedShort_base();
               this.models[var5] = var1.readUnsignedByte_base();
            }
         }
      } else if(var2 == 2) {
         this.name = var1.readStringCp1252NullTerminated_base();
      } else if(var2 == 5) {
         var4 = var1.readUnsignedByte_base();
         if(var4 > 0) {
            if(var3 <= 1840718348) {
               return;
            }

            if(this.modelIds != null) {
               if(var3 <= 1840718348) {
                  return;
               }

               if(!ObjectDefinition_isLowDetail) {
                  var1.offset += 2 * var4;
                  return;
               }
            }

            this.models = null;
            this.modelIds = new int[var4];

            for(var5 = 0; var5 < var4; ++var5) {
               if(var3 <= 1840718348) {
                  return;
               }

               this.modelIds[var5] = var1.readUnsignedShort_base();
            }
         }
      } else if(var2 == 14) {
         if(var3 <= 1840718348) {
            return;
         }

         this.sizeX = var1.readUnsignedByte_base();
      } else if(var2 == 15) {
         this.sizeY = var1.readUnsignedByte_base();
      } else if(var2 == 17) {
         this.interactType = 0;
         this.boolean1 = false;
      } else if(var2 == 18) {
         if(var3 <= 1840718348) {
            return;
         }

         this.boolean1 = false;
      } else if(var2 == 19) {
         this.int1 = var1.readUnsignedByte_base();
      } else if(var2 == 21) {
         this.clipType = 0;
      } else if(var2 == 22) {
         if(var3 <= 1840718348) {
            return;
         }

         this.nonFlatShading = true;
      } else if(var2 == 23) {
         this.modelClipped = true;
      } else if(var2 == 24) {
         this.animationId = var1.readUnsignedShort_base();
         if(this.animationId == 65535) {
            this.animationId = -1;
         }
      } else if(var2 == 27) {
         this.interactType = 1;
      } else if(var2 == 28) {
         if(var3 <= 1840718348) {
            return;
         }

         this.int2 = var1.readUnsignedByte_base();
      } else if(var2 == 29) {
         this.ambient = var1.readByte_base();
      } else if(var2 == 39) {
         this.contrast = var1.readByte_base() * 25;
      } else if(var2 >= 30 && var2 < 35) {
         this.actions[var2 - 30] = var1.readStringCp1252NullTerminated_base();
         if(this.actions[var2 - 30].equalsIgnoreCase("Hidden")) {
            this.actions[var2 - 30] = null;
         }
      } else if(var2 == 40) {
         var4 = var1.readUnsignedByte_base();
         this.recolorFrom = new short[var4];
         this.recolorTo = new short[var4];

         for(var5 = 0; var5 < var4; ++var5) {
            this.recolorFrom[var5] = (short)var1.readUnsignedShort_base();
            this.recolorTo[var5] = (short)var1.readUnsignedShort_base();
         }
      } else if(var2 == 41) {
         var4 = var1.readUnsignedByte_base();
         this.retextureFrom = new short[var4];
         this.retextureTo = new short[var4];

         for(var5 = 0; var5 < var4; ++var5) {
            if(var3 <= 1840718348) {
               return;
            }

            this.retextureFrom[var5] = (short)var1.readUnsignedShort_base();
            this.retextureTo[var5] = (short)var1.readUnsignedShort_base();
         }
      } else if(var2 == 61) {
         var1.readUnsignedShort_base();
      } else if(var2 == 62) {
         this.isRotated = true;
      } else if(var2 == 64) {
         this.clipped = false;
      } else if(var2 == 65) {
         this.modelSizeX = var1.readUnsignedShort_base();
      } else if(var2 == 66) {
         if(var3 <= 1840718348) {
            return;
         }

         this.modelHeight = var1.readUnsignedShort_base();
      } else if(var2 == 67) {
         this.modelSizeY = var1.readUnsignedShort_base();
      } else if(var2 == 68) {
         this.mapSceneId = var1.readUnsignedShort_base();
      } else if(var2 == 69) {
         if(var3 <= 1840718348) {
            return;
         }

         var1.readUnsignedByte_base();
      } else if(var2 == 70) {
         this.offsetX = var1.readShort_base();
      } else if(var2 == 71) {
         if(var3 <= 1840718348) {
            return;
         }

         this.offsetHeight = var1.readShort_base();
      } else if(var2 == 72) {
         this.offsetY = var1.readShort_base();
      } else if(var2 == 73) {
         this.boolean2 = true;
      } else if(var2 == 74) {
         if(var3 <= 1840718348) {
            return;
         }

         this.isSolid = true;
      } else if(var2 == 75) {
         if(var3 <= 1840718348) {
            return;
         }

         this.int3 = var1.readUnsignedByte_base();
      } else {
         if(var2 != 77) {
            if(var3 <= 1840718348) {
               return;
            }

            if(var2 != 92) {
               if(var2 == 78) {
                  this.ambientSoundId = var1.readUnsignedShort_base();
                  this.int7 = var1.readUnsignedByte_base();
                  return;
               } else if(var2 == 79) {
                  this.int5 = var1.readUnsignedShort_base();
                  this.int6 = var1.readUnsignedShort_base();
                  this.int7 = var1.readUnsignedByte_base();
                  var4 = var1.readUnsignedByte_base();
                  this.soundEffectIds = new int[var4];

                  for(var5 = 0; var5 < var4; ++var5) {
                     this.soundEffectIds[var5] = var1.readUnsignedShort_base();
                  }

                  return;
               } else if(var2 == 81) {
                  this.clipType = var1.readUnsignedByte_base() * 256;
                  return;
               } else if(var2 == 82) {
                  this.mapIconId = var1.readUnsignedShort_base();
                  return;
               } else {
                  if(var2 == 89) {
                     this.boolean3 = false;
                  } else if(var2 == 249) {
                     this.params = class144.method3229(var1, this.params);
                     return;
                  }

                  return;
               }
            }
         }

         this.transformVarbit = var1.readUnsignedShort_base();
         if(this.transformVarbit == 65535) {
            this.transformVarbit = -1;
         }

         this.transformVarp = var1.readUnsignedShort_base();
         if(this.transformVarp == 65535) {
            if(var3 <= 1840718348) {
               return;
            }

            this.transformVarp = -1;
         }

         var4 = -1;
         if(var2 == 92) {
            var4 = var1.readUnsignedShort_base();
            if(var4 == 65535) {
               var4 = -1;
            }
         }

         var5 = var1.readUnsignedByte_base();
         this.transforms = new int[var5 + 2];

         for(int var6 = 0; var6 <= var5; ++var6) {
            this.transforms[var6] = var1.readUnsignedShort_base();
            if(this.transforms[var6] == 65535) {
               if(var3 <= 1840718348) {
                  return;
               }

               this.transforms[var6] = -1;
            }
         }

         this.transforms[var5 + 1] = var4;
      }

   }

   public int getAccessBitMask() {
      return this.accessBitMask;
   }

   public int getId() {
      return this.id;
   }

   public String getName() {
      return this.name;
   }

   public int getSizeX() {
      return this.sizeX;
   }

   public int getSizeY() {
      return this.sizeY;
   }

   public int getInteractType() {
      return this.interactType;
   }

   public boolean getBoolean1() {
      return this.boolean1;
   }

   public int getInt1() {
      return this.int1;
   }

   public int getClipType() {
      return this.clipType;
   }

   public boolean getNonFlatShading() {
      return this.nonFlatShading;
   }

   public boolean getModelClipped() {
      return this.modelClipped;
   }

   public int getInt2() {
      return this.int2;
   }

   public int getAmbient() {
      return this.ambient;
   }

   public int getContrast() {
      return this.contrast;
   }

   public int getMapIconId() {
      return this.mapIconId;
   }

   public int getMapSceneId() {
      return this.mapSceneId;
   }

   public boolean getIsRotated() {
      return this.isRotated;
   }

   public boolean getClipped() {
      return this.clipped;
   }

   public int getModelSizeX() {
      return this.modelSizeX;
   }

   public void decodeNext(RSBuffer var1, int var2) {
      this.method3911((Buffer)var1, var2);
   }

   public RSObjectComposition getImpostor() {
      return this.method3907();
   }

   public int getVarbitId() {
      return this.transformVarbit;
   }

   public int[] getImpostorIds() {
      return this.transforms;
   }

   public void setParams(RSIterableNodeHashTable var1) {
      this.params = (IterableNodeHashTable)var1;
   }

   public int getVarPlayerId() {
      return this.transformVarp;
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(II)Lhp;",
      garbageValue = "523066781"
   )
   public static EnumComposition method3947(int var0) {
      EnumComposition var1 = (EnumComposition)EnumComposition.EnumDefinition_cached.get((long)var0);
      if(var1 != null) {
         return var1;
      } else {
         byte[] var2 = EnumComposition.EnumDefinition_archive.takeFile_base(8, var0);
         var1 = new EnumComposition();
         if(var2 != null) {
            var1.method3670(new Buffer(var2));
         }

         EnumComposition.EnumDefinition_cached.put(var1, (long)var0);
         return var1;
      }
   }

   public static void rl$clinit() {
      RSEvictingDualNodeHashTable var0 = SpriteMask.client.getObjectDefinitionModelsCache();
      var0.resize(256);
   }
}
