package mapped;

import net.runelite.api.IterableHashTable;
import net.runelite.api.ParamHolder;
import net.runelite.api.events.PostItemComposition;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSEvictingDualNodeHashTable;
import net.runelite.rs.api.RSIntegerNode;
import net.runelite.rs.api.RSItemComposition;
import net.runelite.rs.api.RSIterableNodeHashTable;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSNode;
import net.runelite.rs.api.RSObjectNode;
import net.runelite.rs.api.RSParamComposition;

@ObfuscatedName("hv")
public class ItemComposition extends DualNode implements RSItemComposition, ParamHolder {
   @ObfuscatedName("aa")
   @ObfuscatedSignature(
      descriptor = "Lol;"
   )
   public static AbstractArchive ItemDefinition_modelArchive;
   @ObfuscatedName("al")
   @ObfuscatedGetter(
      intValue = 602080139
   )
   public static int ItemDefinition_fileCount;
   @ObfuscatedName("az")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   public static EvictingDualNodeHashTable ItemDefinition_cached;
   @ObfuscatedName("ap")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   public static EvictingDualNodeHashTable ItemDefinition_cachedModels;
   @ObfuscatedName("av")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   public static EvictingDualNodeHashTable ItemDefinition_cachedSprites;
   @ObfuscatedName("as")
   @ObfuscatedGetter(
      intValue = 1057797301
   )
   int id;
   @ObfuscatedName("ay")
   @ObfuscatedGetter(
      intValue = 1247120849
   )
   int model;
   @ObfuscatedName("ak")
   public String name;
   @ObfuscatedName("aj")
   public short[] recolorFrom;
   @ObfuscatedName("am")
   public short[] recolorTo;
   @ObfuscatedName("aq")
   public short[] retextureFrom;
   @ObfuscatedName("ai")
   public short[] retextureTo;
   @ObfuscatedName("aw")
   @ObfuscatedGetter(
      intValue = 783523127
   )
   public int zoom2d;
   @ObfuscatedName("ae")
   @ObfuscatedGetter(
      intValue = -1836871881
   )
   public int xan2d;
   @ObfuscatedName("an")
   @ObfuscatedGetter(
      intValue = 1511387279
   )
   public int yan2d;
   @ObfuscatedName("ag")
   @ObfuscatedGetter(
      intValue = 1587488789
   )
   public int zan2d;
   @ObfuscatedName("ad")
   @ObfuscatedGetter(
      intValue = -1328440911
   )
   public int offsetX2d;
   @ObfuscatedName("af")
   @ObfuscatedGetter(
      intValue = 298521971
   )
   public int offsetY2d;
   @ObfuscatedName("bl")
   @ObfuscatedGetter(
      intValue = -1717497019
   )
   public int isStackable;
   @ObfuscatedName("bi")
   @ObfuscatedGetter(
      intValue = 339486489
   )
   public int price;
   @ObfuscatedName("bv")
   @ObfuscatedGetter(
      intValue = -1665426075
   )
   public int maleModel;
   @ObfuscatedName("bf")
   @ObfuscatedGetter(
      intValue = -200366113
   )
   public int maleModel1;
   @ObfuscatedName("bg")
   @ObfuscatedGetter(
      intValue = -1280562249
   )
   public int maleModel2;
   @ObfuscatedName("ba")
   public boolean isMembersOnly;
   @ObfuscatedName("bm")
   public String[] groundActions;
   @ObfuscatedName("bp")
   public String[] inventoryActions;
   @ObfuscatedName("bj")
   @ObfuscatedGetter(
      intValue = -1176948897
   )
   int shiftClickIndex;
   @ObfuscatedName("bn")
   @ObfuscatedGetter(
      intValue = -1734637427
   )
   int femaleModel;
   @ObfuscatedName("bo")
   @ObfuscatedGetter(
      intValue = 1870522765
   )
   int femaleModel1;
   @ObfuscatedName("bt")
   @ObfuscatedGetter(
      intValue = -396714303
   )
   int femaleOffset;
   @ObfuscatedName("bu")
   @ObfuscatedGetter(
      intValue = -1960253581
   )
   int maleHeadModel;
   @ObfuscatedName("by")
   @ObfuscatedGetter(
      intValue = 570338941
   )
   int maleHeadModel2;
   @ObfuscatedName("bh")
   @ObfuscatedGetter(
      intValue = -2078053189
   )
   int field2164;
   @ObfuscatedName("bz")
   @ObfuscatedGetter(
      intValue = 253873041
   )
   int femaleModel2;
   @ObfuscatedName("bc")
   @ObfuscatedGetter(
      intValue = -8602255
   )
   int femaleHeadModel;
   @ObfuscatedName("bs")
   @ObfuscatedGetter(
      intValue = 408060625
   )
   int femaleHeadModel2;
   @ObfuscatedName("bx")
   @ObfuscatedGetter(
      intValue = 273824429
   )
   int field2147;
   @ObfuscatedName("bb")
   @ObfuscatedGetter(
      intValue = -1164055145
   )
   int field2169;
   @ObfuscatedName("bk")
   @ObfuscatedGetter(
      intValue = 1288246625
   )
   int field2170;
   @ObfuscatedName("br")
   int[] countobj;
   @ObfuscatedName("bq")
   int[] countco;
   @ObfuscatedName("cf")
   @ObfuscatedGetter(
      intValue = 474592341
   )
   public int note;
   @ObfuscatedName("cg")
   @ObfuscatedGetter(
      intValue = 1875339961
   )
   public int noteTemplate;
   @ObfuscatedName("cv")
   @ObfuscatedGetter(
      intValue = -146495851
   )
   int resizeX;
   @ObfuscatedName("cx")
   @ObfuscatedGetter(
      intValue = -691090345
   )
   int resizeY;
   @ObfuscatedName("cp")
   @ObfuscatedGetter(
      intValue = -1800630767
   )
   int resizeZ;
   @ObfuscatedName("ce")
   @ObfuscatedGetter(
      intValue = -991400021
   )
   public int ambient;
   @ObfuscatedName("ci")
   @ObfuscatedGetter(
      intValue = 1214168515
   )
   public int contrast;
   @ObfuscatedName("ct")
   @ObfuscatedGetter(
      intValue = -1226093009
   )
   public int team;
   @ObfuscatedName("cw")
   @ObfuscatedGetter(
      intValue = -1872820577
   )
   public int field2181;
   @ObfuscatedName("cq")
   @ObfuscatedSignature(
      descriptor = "Ltz;"
   )
   IterableNodeHashTable params;
   @ObfuscatedName("cl")
   public boolean isTradable;
   @ObfuscatedName("cs")
   @ObfuscatedGetter(
      intValue = -740767955
   )
   int unnotedId;
   @ObfuscatedName("co")
   @ObfuscatedGetter(
      intValue = -613303161
   )
   int notedId;
   @ObfuscatedName("cm")
   @ObfuscatedGetter(
      intValue = 402164487
   )
   public int placeholder;
   @ObfuscatedName("cn")
   @ObfuscatedGetter(
      intValue = 2056062487
   )
   public int placeholderTemplate;
   public int shiftClickActionIndex;

   static {
      ItemDefinition_cached = new EvictingDualNodeHashTable(64);
      ItemDefinition_cachedModels = new EvictingDualNodeHashTable(50);
      ItemDefinition_cachedSprites = new EvictingDualNodeHashTable(200);
   }

   ItemComposition() {
      this.name = "null";
      this.zoom2d = 2000;
      this.xan2d = 0;
      this.yan2d = 0;
      this.zan2d = 0;
      this.offsetX2d = 0;
      this.offsetY2d = 0;
      this.isStackable = 0;
      this.price = 1;
      this.maleModel = -1;
      this.maleModel1 = -1;
      this.maleModel2 = -1;
      this.isMembersOnly = false;
      this.groundActions = new String[]{null, null, "Take", null, null};
      this.inventoryActions = new String[]{null, null, null, null, "Drop"};
      this.shiftClickIndex = -2;
      this.femaleModel = -1;
      this.femaleModel1 = -1;
      this.femaleOffset = 0;
      this.maleHeadModel = -1;
      this.maleHeadModel2 = -1;
      this.field2164 = 0;
      this.femaleModel2 = -1;
      this.femaleHeadModel = -1;
      this.femaleHeadModel2 = -1;
      this.field2147 = -1;
      this.field2169 = -1;
      this.field2170 = -1;
      this.note = -1;
      this.noteTemplate = -1;
      this.resizeX = 128;
      this.resizeY = 128;
      this.resizeZ = 128;
      this.ambient = 0;
      this.contrast = 0;
      this.team = 0;
      this.field2181 = 0;
      this.isTradable = false;
      this.unnotedId = -1;
      this.notedId = -1;
      this.placeholder = -1;
      this.placeholderTemplate = -1;
      this.rl$$init();
      this.rl$init();
   }

   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "1127699243"
   )
   void post_base() {
      if(this.isStackable == 1) {
         this.field2181 = 0;
      }

      this.post();
   }

   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "(Luj;I)V",
      garbageValue = "1081544822"
   )
   void method3950(Buffer var1) {
      while(true) {
         int var2 = var1.readUnsignedByte_base();
         if(var2 == 0) {
            return;
         }

         this.method3951(var1, var2);
      }
   }

   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "(Luj;IS)V",
      garbageValue = "321"
   )
   void method3951(Buffer var1, int var2) {
      if(var2 == 1) {
         this.model = var1.readUnsignedShort_base();
      } else if(var2 == 2) {
         this.name = var1.readStringCp1252NullTerminated_base();
      } else if(var2 == 4) {
         this.zoom2d = var1.readUnsignedShort_base();
      } else if(var2 == 5) {
         this.xan2d = var1.readUnsignedShort_base();
      } else if(var2 == 6) {
         this.yan2d = var1.readUnsignedShort_base();
      } else if(var2 == 7) {
         this.offsetX2d = var1.readUnsignedShort_base();
         if(this.offsetX2d > 32767) {
            this.offsetX2d -= 65536;
         }
      } else if(var2 == 8) {
         this.offsetY2d = var1.readUnsignedShort_base();
         if(this.offsetY2d > 32767) {
            this.offsetY2d -= 65536;
         }
      } else if(var2 == 9) {
         var1.readStringCp1252NullTerminated_base();
      } else if(var2 == 11) {
         this.isStackable = 1;
      } else if(var2 == 12) {
         this.price = var1.readInt_base();
      } else if(var2 == 13) {
         this.maleModel = var1.readUnsignedByte_base();
      } else if(var2 == 14) {
         this.maleModel1 = var1.readUnsignedByte_base();
      } else if(var2 == 16) {
         this.isMembersOnly = true;
      } else if(var2 == 23) {
         this.femaleModel = var1.readUnsignedShort_base();
         this.femaleOffset = var1.readUnsignedByte_base();
      } else if(var2 == 24) {
         this.femaleModel1 = var1.readUnsignedShort_base();
      } else if(var2 == 25) {
         this.maleHeadModel = var1.readUnsignedShort_base();
         this.field2164 = var1.readUnsignedByte_base();
      } else if(var2 == 26) {
         this.maleHeadModel2 = var1.readUnsignedShort_base();
      } else if(var2 == 27) {
         this.maleModel2 = var1.readUnsignedByte_base();
      } else if(var2 >= 30 && var2 < 35) {
         this.groundActions[var2 - 30] = var1.readStringCp1252NullTerminated_base();
         if(this.groundActions[var2 - 30].equalsIgnoreCase("Hidden")) {
            this.groundActions[var2 - 30] = null;
         }
      } else if(var2 >= 35 && var2 < 40) {
         this.inventoryActions[var2 - 35] = var1.readStringCp1252NullTerminated_base();
      } else {
         int var3;
         int var4;
         if(var2 == 40) {
            var3 = var1.readUnsignedByte_base();
            this.recolorFrom = new short[var3];
            this.recolorTo = new short[var3];

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

            for(var4 = 0; var4 < var3; ++var4) {
               this.retextureFrom[var4] = (short)var1.readUnsignedShort_base();
               this.retextureTo[var4] = (short)var1.readUnsignedShort_base();
            }
         } else if(var2 == 42) {
            this.shiftClickIndex = var1.readByte_base();
         } else if(var2 == 65) {
            this.isTradable = true;
         } else if(var2 == 75) {
            this.field2181 = var1.readShort_base();
         } else if(var2 == 78) {
            this.femaleModel2 = var1.readUnsignedShort_base();
         } else if(var2 == 79) {
            this.femaleHeadModel = var1.readUnsignedShort_base();
         } else if(var2 == 90) {
            this.femaleHeadModel2 = var1.readUnsignedShort_base();
         } else if(var2 == 91) {
            this.field2169 = var1.readUnsignedShort_base();
         } else if(var2 == 92) {
            this.field2147 = var1.readUnsignedShort_base();
         } else if(var2 == 93) {
            this.field2170 = var1.readUnsignedShort_base();
         } else if(var2 == 94) {
            var1.readUnsignedShort_base();
         } else if(var2 == 95) {
            this.zan2d = var1.readUnsignedShort_base();
         } else if(var2 == 97) {
            this.note = var1.readUnsignedShort_base();
         } else if(var2 == 98) {
            this.noteTemplate = var1.readUnsignedShort_base();
         } else if(var2 >= 100 && var2 < 110) {
            if(this.countobj == null) {
               this.countobj = new int[10];
               this.countco = new int[10];
            }

            this.countobj[var2 - 100] = var1.readUnsignedShort_base();
            this.countco[var2 - 100] = var1.readUnsignedShort_base();
         } else if(var2 == 110) {
            this.resizeX = var1.readUnsignedShort_base();
         } else if(var2 == 111) {
            this.resizeY = var1.readUnsignedShort_base();
         } else if(var2 == 112) {
            this.resizeZ = var1.readUnsignedShort_base();
         } else if(var2 == 113) {
            this.ambient = var1.readByte_base();
         } else if(var2 == 114) {
            this.contrast = var1.readByte_base() * 5;
         } else if(var2 == 115) {
            this.team = var1.readUnsignedByte_base();
         } else if(var2 == 139) {
            this.unnotedId = var1.readUnsignedShort_base();
         } else if(var2 == 140) {
            this.notedId = var1.readUnsignedShort_base();
         } else if(var2 == 148) {
            this.placeholder = var1.readUnsignedShort_base();
         } else if(var2 == 149) {
            this.placeholderTemplate = var1.readUnsignedShort_base();
         } else if(var2 == 249) {
            this.params = class144.method3229(var1, this.params);
         }
      }

   }

   @ObfuscatedName("ab")
   @ObfuscatedSignature(
      descriptor = "(Lhv;Lhv;I)V",
      garbageValue = "672457360"
   )
   void method4011(ItemComposition var1, ItemComposition var2) {
      this.model = var1.model;
      this.zoom2d = var1.zoom2d;
      this.xan2d = var1.xan2d;
      this.yan2d = var1.yan2d;
      this.zan2d = var1.zan2d;
      this.offsetX2d = var1.offsetX2d;
      this.offsetY2d = var1.offsetY2d;
      this.recolorFrom = var1.recolorFrom;
      this.recolorTo = var1.recolorTo;
      this.retextureFrom = var1.retextureFrom;
      this.retextureTo = var1.retextureTo;
      this.name = var2.name;
      this.isMembersOnly = var2.isMembersOnly;
      this.price = var2.price;
      this.isStackable = 1;
   }

   @ObfuscatedName("au")
   @ObfuscatedSignature(
      descriptor = "(Lhv;Lhv;B)V",
      garbageValue = "0"
   )
   void method3953(ItemComposition var1, ItemComposition var2) {
      this.model = var1.model;
      this.zoom2d = var1.zoom2d;
      this.xan2d = var1.xan2d;
      this.yan2d = var1.yan2d;
      this.zan2d = var1.zan2d;
      this.offsetX2d = var1.offsetX2d;
      this.offsetY2d = var1.offsetY2d;
      this.recolorFrom = var2.recolorFrom;
      this.recolorTo = var2.recolorTo;
      this.retextureFrom = var2.retextureFrom;
      this.retextureTo = var2.retextureTo;
      this.name = var2.name;
      this.isMembersOnly = var2.isMembersOnly;
      this.isStackable = var2.isStackable;
      this.maleModel = var2.maleModel;
      this.maleModel1 = var2.maleModel1;
      this.maleModel2 = var2.maleModel2;
      this.femaleModel = var2.femaleModel;
      this.femaleModel1 = var2.femaleModel1;
      this.femaleModel2 = var2.femaleModel2;
      this.maleHeadModel = var2.maleHeadModel;
      this.maleHeadModel2 = var2.maleHeadModel2;
      this.femaleHeadModel = var2.femaleHeadModel;
      this.femaleHeadModel2 = var2.femaleHeadModel2;
      this.field2147 = var2.field2147;
      this.field2169 = var2.field2169;
      this.field2170 = var2.field2170;
      this.team = var2.team;
      this.groundActions = var2.groundActions;
      this.field2181 = var2.field2181;
      this.inventoryActions = new String[5];
      if(var2.inventoryActions != null) {
         for(int var3 = 0; var3 < 4; ++var3) {
            this.inventoryActions[var3] = var2.inventoryActions[var3];
         }
      }

      this.inventoryActions[4] = "Discard";
      this.price = 0;
   }

   @ObfuscatedName("aa")
   @ObfuscatedSignature(
      descriptor = "(Lhv;Lhv;I)V",
      garbageValue = "1710826520"
   )
   void method3997(ItemComposition var1, ItemComposition var2) {
      this.model = var1.model;
      this.zoom2d = var1.zoom2d;
      this.xan2d = var1.xan2d;
      this.yan2d = var1.yan2d;
      this.zan2d = var1.zan2d;
      this.offsetX2d = var1.offsetX2d;
      this.offsetY2d = var1.offsetY2d;
      this.recolorFrom = var1.recolorFrom;
      this.recolorTo = var1.recolorTo;
      this.retextureFrom = var1.retextureFrom;
      this.retextureTo = var1.retextureTo;
      this.isStackable = var1.isStackable;
      this.name = var2.name;
      this.price = 0;
      this.isMembersOnly = false;
      this.isTradable = false;
   }

   @ObfuscatedName("ac")
   @ObfuscatedSignature(
      descriptor = "(II)Lkq;",
      garbageValue = "-1456114839"
   )
   public final ModelData method3955(int var1) {
      int var3;
      if(this.countobj != null && var1 > 1) {
         int var2 = -1;

         for(var3 = 0; var3 < 10; ++var3) {
            if(var1 >= this.countco[var3] && this.countco[var3] != 0) {
               var2 = this.countobj[var3];
            }
         }

         if(var2 != -1) {
            return class214.method4226(var2).method3955(1);
         }
      }

      ModelData var4 = ModelData.method5100(ItemDefinition_modelArchive, this.model, 0);
      if(var4 == null) {
         return null;
      } else {
         if(this.resizeX != 128 || this.resizeY != 128 || this.resizeZ != 128) {
            var4.resize_base(this.resizeX, this.resizeY, this.resizeZ);
         }

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

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

         return var4;
      }
   }

   @ObfuscatedName("al")
   @ObfuscatedSignature(
      descriptor = "(II)Lka;",
      garbageValue = "1125634368"
   )
   public final Model method3956(int var1) {
      if(this.countobj != null && var1 > 1) {
         int var2 = -1;

         for(int var3 = 0; var3 < 10; ++var3) {
            if(var1 >= this.countco[var3] && this.countco[var3] != 0) {
               var2 = this.countobj[var3];
            }
         }

         if(var2 != -1) {
            return class214.method4226(var2).method3956(1);
         }
      }

      Model var5 = (Model)ItemDefinition_cachedModels.get((long)this.id);
      if(var5 != null) {
         return var5;
      } else {
         ModelData var6 = ModelData.method5100(ItemDefinition_modelArchive, this.model, 0);
         if(var6 == null) {
            return null;
         } else {
            if(this.resizeX != 128 || this.resizeY != 128 || this.resizeZ != 128) {
               var6.resize_base(this.resizeX, this.resizeY, this.resizeZ);
            }

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

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

            var5 = var6.method5122(this.ambient + 64, this.contrast + 768, -50, -10, -50);
            var5.isSingleTile = true;
            ItemDefinition_cachedModels.put(var5, (long)this.id);
            return var5;
         }
      }
   }

   @ObfuscatedName("az")
   @ObfuscatedSignature(
      descriptor = "(II)Lhv;",
      garbageValue = "1493083916"
   )
   public ItemComposition method3957(int var1) {
      if(this.countobj != null && var1 > 1) {
         int var2 = -1;

         for(int var3 = 0; var3 < 10; ++var3) {
            if(var1 >= this.countco[var3] && this.countco[var3] != 0) {
               var2 = this.countobj[var3];
            }
         }

         if(var2 != -1) {
            return class214.method4226(var2);
         }
      }

      return this;
   }

   @ObfuscatedName("av")
   @ObfuscatedSignature(
      descriptor = "(IB)Z",
      garbageValue = "0"
   )
   public final boolean method3958_base(int var1) {
      int var2 = this.femaleModel;
      int var3 = this.femaleModel1;
      int var4 = this.femaleModel2;
      if(var1 == 1) {
         var2 = this.maleHeadModel;
         var3 = this.maleHeadModel2;
         var4 = this.femaleHeadModel;
      }

      if(var2 == -1) {
         return true;
      } else {
         boolean var5 = true;
         if(!ItemDefinition_modelArchive.tryLoadFile_base(var2, 0)) {
            var5 = false;
         }

         if(var3 != -1 && !ItemDefinition_modelArchive.tryLoadFile_base(var3, 0)) {
            var5 = false;
         }

         if(var4 != -1 && !ItemDefinition_modelArchive.tryLoadFile_base(var4, 0)) {
            var5 = false;
         }

         return var5;
      }
   }

   @ObfuscatedName("ax")
   @ObfuscatedSignature(
      descriptor = "(IB)Lkq;",
      garbageValue = "4"
   )
   public final ModelData method3961(int var1) {
      int var2 = this.femaleModel;
      int var3 = this.femaleModel1;
      int var4 = this.femaleModel2;
      if(var1 == 1) {
         var2 = this.maleHeadModel;
         var3 = this.maleHeadModel2;
         var4 = this.femaleHeadModel;
      }

      if(var2 == -1) {
         return null;
      } else {
         ModelData var5 = ModelData.method5100(ItemDefinition_modelArchive, var2, 0);
         if(var3 != -1) {
            ModelData var6 = ModelData.method5100(ItemDefinition_modelArchive, var3, 0);
            if(var4 != -1) {
               ModelData var7 = ModelData.method5100(ItemDefinition_modelArchive, var4, 0);
               ModelData[] var8 = new ModelData[]{var5, var6, var7};
               var5 = new ModelData(var8, 3);
            } else {
               ModelData[] var10 = new ModelData[]{var5, var6};
               var5 = new ModelData(var10, 2);
            }
         }

         if(var1 == 0 && this.femaleOffset != 0) {
            var5.changeOffset_base(0, this.femaleOffset, 0);
         }

         if(var1 == 1 && this.field2164 != 0) {
            var5.changeOffset_base(0, this.field2164, 0);
         }

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

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

         return var5;
      }
   }

   @ObfuscatedName("as")
   @ObfuscatedSignature(
      descriptor = "(II)Z",
      garbageValue = "-1904060082"
   )
   public final boolean method3960_base(int var1) {
      int var2 = this.femaleHeadModel2;
      int var3 = this.field2147;
      if(var1 == 1) {
         var2 = this.field2169;
         var3 = this.field2170;
      }

      if(var2 == -1) {
         return true;
      } else {
         boolean var4 = true;
         if(!ItemDefinition_modelArchive.tryLoadFile_base(var2, 0)) {
            var4 = false;
         }

         if(var3 != -1 && !ItemDefinition_modelArchive.tryLoadFile_base(var3, 0)) {
            var4 = false;
         }

         return var4;
      }
   }

   @ObfuscatedName("ay")
   @ObfuscatedSignature(
      descriptor = "(II)Lkq;",
      garbageValue = "1718936593"
   )
   public final ModelData method3986(int var1) {
      int var2 = this.femaleHeadModel2;
      int var3 = this.field2147;
      if(var1 == 1) {
         var2 = this.field2169;
         var3 = this.field2170;
      }

      if(var2 == -1) {
         return null;
      } else {
         ModelData var4 = ModelData.method5100(ItemDefinition_modelArchive, var2, 0);
         if(var3 != -1) {
            ModelData var5 = ModelData.method5100(ItemDefinition_modelArchive, var3, 0);
            ModelData[] var6 = new ModelData[]{var4, var5};
            var4 = new ModelData(var6, 2);
         }

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

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

         return var4;
      }
   }

   @ObfuscatedName("ak")
   @ObfuscatedSignature(
      descriptor = "(IIB)I",
      garbageValue = "20"
   )
   public int getIntParam_base(int var1, int var2) {
      return Player.method2444(this.params, var1, var2);
   }

   @ObfuscatedName("aj")
   @ObfuscatedSignature(
      descriptor = "(ILjava/lang/String;B)Ljava/lang/String;",
      garbageValue = "88"
   )
   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("am")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "1"
   )
   public int getShiftClickIndex_base() {
      return this.shiftClickActionIndex == -2?this.copy$getShiftClickIndex((byte)1):this.shiftClickActionIndex;
   }

   @ObfuscatedName("ai")
   @ObfuscatedSignature(
      descriptor = "(B)Z",
      garbageValue = "-121"
   )
   boolean method3965_base() {
      return this.recolorTo != null;
   }

   @ObfuscatedName("aw")
   @ObfuscatedSignature(
      descriptor = "(B)Z",
      garbageValue = "-67"
   )
   boolean method3952_base() {
      return this.retextureTo != null;
   }

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

   public int getIsStackable() {
      return this.isStackable;
   }

   public int getPrice() {
      return this.price;
   }

   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);
      }
   }

   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "1"
   )
   public int copy$getShiftClickIndex(byte var1) {
      return this.shiftClickIndex != -1 && this.inventoryActions != null?(this.shiftClickIndex >= 0?(this.inventoryActions[this.shiftClickIndex] != null?this.shiftClickIndex:-1):("Drop".equalsIgnoreCase(this.inventoryActions[4])?4:-1)):-1;
   }

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

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

   private void rl$$init() {
      this.shiftClickActionIndex = -2;
   }

   public final void rl$init() {
      RSEvictingDualNodeHashTable var1 = SpriteMask.client.getItemCompositionCache();
      var1.resize(1024);
   }

   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));
   }

   public boolean isStackable() {
      return this.getIsStackable() != 0;
   }

   public void setShiftClickActionIndex(int var1) {
      this.shiftClickActionIndex = var1;
   }

   public void resetShiftClickActionIndex() {
      this.shiftClickActionIndex = -2;
   }

   public int getHaPrice() {
      int var1 = this.getPrice();
      return (int)((float)var1 * 0.6F);
   }

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

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

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

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

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

   public int getMaleModel() {
      return this.maleModel;
   }

   public boolean isMembers() {
      return this.isMembersOnly;
   }

   public String[] getGroundActions() {
      return this.groundActions;
   }

   public String[] getInventoryActions() {
      return this.inventoryActions;
   }

   public int getLinkedNoteId() {
      return this.note;
   }

   public int getNote() {
      return this.noteTemplate;
   }

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

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

   public boolean isTradeable() {
      return this.isTradable;
   }

   public void setTradeable(boolean var1) {
      this.isTradable = var1;
   }

   public int getInventoryModel() {
      return this.unnotedId;
   }

   public int getPlaceholderId() {
      return this.placeholder;
   }

   public int getPlaceholderTemplateId() {
      return this.placeholderTemplate;
   }

   public RSModel getModel(int var1) {
      return this.method3956(var1);
   }

   public int getShiftClickActionIndex() {
      return this.getShiftClickIndex_base();
   }

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

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

   @ObfuscatedName("aq")
   @ObfuscatedSignature(
      descriptor = "(ILdt;ZI)I",
      garbageValue = "-1566499542"
   )
   static int method4015(int var0, Script var1, boolean var2) {
      Widget var3 = var2?Interpreter.scriptDotWidget:HealthBar.scriptActiveWidget;
      if(var0 == 1800) {
         Interpreter.Interpreter_intStack[++DbTableType.Interpreter_intStackSize - 1] = WorldMapData_0.Widget_unpackTargetMask_base(class361.method6871(var3));
         return 1;
      } else if(var0 != 1801) {
         if(var0 == 1802) {
            if(var3.dataText == null) {
               Interpreter.Interpreter_stringStack[++class127.Interpreter_stringStackSize - 1] = "";
            } else {
               Interpreter.Interpreter_stringStack[++class127.Interpreter_stringStackSize - 1] = var3.dataText;
            }

            return 1;
         } else {
            return 2;
         }
      } else {
         int var4 = Interpreter.Interpreter_intStack[--DbTableType.Interpreter_intStackSize];
         --var4;
         if(var3.actions != null && var4 < var3.actions.length && var3.actions[var4] != null) {
            Interpreter.Interpreter_stringStack[++class127.Interpreter_stringStackSize - 1] = var3.actions[var4];
         } else {
            Interpreter.Interpreter_stringStack[++class127.Interpreter_stringStackSize - 1] = "";
         }

         return 1;
      }
   }

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

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

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

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

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

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

   public int getXan2d() {
      return this.xan2d;
   }

   public void setXan2d(int var1) {
      this.xan2d = var1;
   }

   public int getYan2d() {
      return this.yan2d;
   }

   public void setYan2d(int var1) {
      this.yan2d = var1;
   }

   public int getZan2d() {
      return this.zan2d;
   }

   public void setZan2d(int var1) {
      this.zan2d = var1;
   }

   public void setInventoryModel(int var1) {
      this.unnotedId = var1;
   }
}
