import java.util.HashMap;
import java.util.Map;

public class Class574 {

   int anInt7596 = -1489078991;
   int anInt7597 = 1333046175;
   int[] anIntArray7598;
   Class577 aClass577_7599;
   int anInt7600;
   public static Class8 aClass8_7601;
   public static Class558 aClass558_7602;


   void method12195(RS2Buffer var1) {
      while(true) {
         int var2 = var1.readUnsignedByte(-700559597);
         if(0 == var2) {
            return;
         }

         this.method12197(var1, var2, 2095587491);
      }
   }

   void method12196(RS2Buffer var1, int var2) {
      while(true) {
         int var3 = var1.readUnsignedByte(-700559597);
         if(0 == var3) {
            return;
         }

         this.method12197(var1, var3, 2099191453);
      }
   }

   void method12197(RS2Buffer var1, int var2, int var3) {
      if(1 == var2) {
         this.anInt7596 = var1.readUnsignedShort(-937710807) * 1489078991;
      } else if(var2 == 2) {
         this.anIntArray7598 = new int[var1.readUnsignedByte(-700559597)];

         for(int var4 = 0; var4 < this.anIntArray7598.length; ++var4) {
            this.anIntArray7598[var4] = var1.readUnsignedShort(-937710807);
         }
      } else if(var2 == 3) {
         this.anInt7597 = var1.readUnsignedByte(-700559597) * -1333046175;
      } else if(var2 == 4) {
         this.aClass577_7599 = (Class577)Class79.method1636(Class120.method2329(1226500412), var1.readUnsignedByte(-700559597), (byte)17);
      } else if(var2 == 5) {
         this.anInt7600 = var1.readLargeSmart(1960824158) * -146240449;
      }

   }

   void method12198(RS2Buffer var1) {
      while(true) {
         int var2 = var1.readUnsignedByte(-700559597);
         if(0 == var2) {
            return;
         }

         this.method12197(var1, var2, 1603474229);
      }
   }

   Class574() {
      this.aClass577_7599 = Class577.aClass577_7612;
      this.anInt7600 = 146240449;
   }

   void method12199(RS2Buffer var1) {
      while(true) {
         int var2 = var1.readUnsignedByte(-700559597);
         if(0 == var2) {
            return;
         }

         this.method12197(var1, var2, 1951865255);
      }
   }

   static void method12200(int var0) {
      for(Class225_Sub14_Sub3 var1 = (Class225_Sub14_Sub3)Class2.aClass456_29.method7682((byte)91); null != var1; var1 = (Class225_Sub14_Sub3)Class2.aClass456_29.method7666(-2117981906)) {
         if(Class463_Sub6.method12845(1158601069 * var1.anInt10024, (byte)-1)) {
            Class226.method3934(var1, (short)2563);
         }
      }

   }

   static final void method12201(Class508 var0, int var1) {
      if(Class225_Sub21_Sub3.aClass234_10080.method4052(86, (short)160)) {
         var0.anIntArray6027[(var0.anInt6003 += 98312473) * -937710807 - 1] = 1;
      } else {
         var0.anIntArray6027[(var0.anInt6003 += 98312473) * -937710807 - 1] = 0;
      }

   }

   public static Interface50 method12202(Class var0, int var1, int var2) {
      Map var3 = Class494.aMap5914;
      synchronized(var3) {
         Object var4 = (Map)Class494.aMap5914.get(var0);
         if(var4 == null) {
            var4 = new HashMap();
            Interface50[] var5 = (Interface50[])((Interface50[])var0.getEnumConstants());

            for(int var6 = 0; var6 < var5.length; ++var6) {
               Interface50 var7 = var5[var6];
               ((Map)var4).put(Integer.valueOf(var7.method89((byte)0)), var7);
            }

            Class494.aMap5914.put(var0, var4);
         }

         return (Interface50)((Map)var4).get(Integer.valueOf(var1));
      }
   }

   static final boolean method12203(Class572[][][] var0, int var1, int var2, int var3, boolean var4, int var5) {
      byte[][][] var6 = client.aClass279_7807.method4925(-352420938);
      byte var7 = var4?1:(byte)(client.anInt7771 * 207556179 & 255);
      if(var7 == var6[-117136075 * Class181.anInt2197][var2][var3]) {
         return false;
      } else {
         Class255 var8 = client.aClass279_7807.method5026(1497651504);
         if((var8.aByteArrayArrayArray3028[Class181.anInt2197 * -117136075][var2][var3] & 4) == 0) {
            return false;
         } else {
            byte var9 = 0;
            int var10 = 0;
            client.anIntArray7728[var9] = var2;
            int var26 = var9 + 1;
            client.anIntArray7729[var9] = var3;
            var6[-117136075 * Class181.anInt2197][var2][var3] = var7;

            while(var26 != var10) {
               int var11 = client.anIntArray7728[var10] & '\uffff';
               int var12 = client.anIntArray7728[var10] >> 16 & 255;
               int var13 = client.anIntArray7728[var10] >> 24 & 255;
               int var14 = client.anIntArray7729[var10] & '\uffff';
               int var15 = client.anIntArray7729[var10] >> 16 & 255;
               var10 = var10 + 1 & 4095;
               boolean var16 = false;
               if(0 == (var8.aByteArrayArrayArray3028[-117136075 * Class181.anInt2197][var11][var14] & 4)) {
                  var16 = true;
               }

               boolean var17 = false;
               int var19;
               int var18;
               int var20;
               if(var0 != null) {
                  label231:
                  for(var18 = 1 + Class181.anInt2197 * -117136075; var18 <= 3; ++var18) {
                     if(null != var0[var18] && 0 == (var8.aByteArrayArrayArray3028[var18][var11][var14] & 8)) {
                        Class515_Sub1_Sub4 var21;
                        int var23;
                        Class572 var27;
                        Class239 var28;
                        if(var16 && var0[var18][var11][var14] != null) {
                           if(var0[var18][var11][var14].aClass515_Sub1_Sub3_7578 != null) {
                              var19 = Class225_Sub18.method13624(var12, 2130279974);
                              if(var19 == var0[var18][var11][var14].aClass515_Sub1_Sub3_7578.aShort10417 || var0[var18][var11][var14].aClass515_Sub1_Sub3_7586 != null && var19 == var0[var18][var11][var14].aClass515_Sub1_Sub3_7586.aShort10417) {
                                 continue;
                              }

                              if(var13 != 0) {
                                 var20 = Class225_Sub18.method13624(var13, 1250074821);
                                 if(var0[var18][var11][var14].aClass515_Sub1_Sub3_7578.aShort10417 == var20 || var0[var18][var11][var14].aClass515_Sub1_Sub3_7586 != null && var20 == var0[var18][var11][var14].aClass515_Sub1_Sub3_7586.aShort10417) {
                                    continue;
                                 }
                              }

                              if(0 != var15) {
                                 var20 = Class225_Sub18.method13624(var15, 287427920);
                                 if(var0[var18][var11][var14].aClass515_Sub1_Sub3_7578.aShort10417 == var20 || null != var0[var18][var11][var14].aClass515_Sub1_Sub3_7586 && var0[var18][var11][var14].aClass515_Sub1_Sub3_7586.aShort10417 == var20) {
                                    continue;
                                 }
                              }
                           }

                           var27 = var0[var18][var11][var14];
                           if(var27.aClass239_7584 != null) {
                              for(var28 = var27.aClass239_7584; null != var28; var28 = var28.aClass239_2838) {
                                 var21 = var28.aClass515_Sub1_Sub4_2839;
                                 if(var21 instanceof Interface20) {
                                    Interface20 var22 = (Interface20)var21;
                                    var23 = var22.method89((byte)39);
                                    int var24 = var22.method87(-1010513860);
                                    if(var23 == 21) {
                                       var23 = 19;
                                    }

                                    int var25 = var23 | var24 << 6;
                                    if(var12 == var25 || 0 != var13 && var25 == var13 || var15 != 0 && var25 == var15) {
                                       continue label231;
                                    }
                                 }
                              }
                           }
                        }

                        var27 = var0[var18][var11][var14];
                        if(var27 != null && null != var27.aClass239_7584) {
                           for(var28 = var27.aClass239_7584; var28 != null; var28 = var28.aClass239_2838) {
                              var21 = var28.aClass515_Sub1_Sub4_2839;
                              if(var21.aShort10429 != var21.aShort10430 || var21.aShort10424 != var21.aShort10426) {
                                 for(int var29 = var21.aShort10430; var29 <= var21.aShort10429; ++var29) {
                                    for(var23 = var21.aShort10424; var23 <= var21.aShort10426; ++var23) {
                                       var6[var18][var29][var23] = var7;
                                    }
                                 }
                              }
                           }
                        }

                        var6[var18][var11][var14] = var7;
                        var17 = true;
                     }
                  }
               }

               if(var17) {
                  var18 = client.aClass279_7807.method4917(-2045526760).aClass400Array2859[1 + Class181.anInt2197 * -117136075].method6789(var11, var14, (byte)3);
                  if(client.anIntArray7787[var1] < var18) {
                     client.anIntArray7787[var1] = var18;
                  }

                  var19 = var11 << 9;
                  var20 = var14 << 9;
                  if(client.anIntArray7788[var1] > var19) {
                     client.anIntArray7788[var1] = var19;
                  } else if(client.anIntArray7789[var1] < var19) {
                     client.anIntArray7789[var1] = var19;
                  }

                  if(client.anIntArray7791[var1] > var20) {
                     client.anIntArray7791[var1] = var20;
                  } else if(client.anIntArray7862[var1] < var20) {
                     client.anIntArray7862[var1] = var20;
                  }
               }

               if(!var16) {
                  if(var11 >= 1 && var7 != var6[-117136075 * Class181.anInt2197][var11 - 1][var14]) {
                     client.anIntArray7728[var26] = var11 - 1 | 1179648 | -754974720;
                     client.anIntArray7729[var26] = var14 | 1245184;
                     var26 = var26 + 1 & 4095;
                     var6[Class181.anInt2197 * -117136075][var11 - 1][var14] = var7;
                  }

                  ++var14;
                  if(var14 < client.aClass279_7807.method4911((byte)-23)) {
                     if(var11 - 1 >= 0 && var6[Class181.anInt2197 * -117136075][var11 - 1][var14] != var7 && (var8.aByteArrayArrayArray3028[Class181.anInt2197 * -117136075][var11][var14] & 4) == 0 && (var8.aByteArrayArrayArray3028[-117136075 * Class181.anInt2197][var11 - 1][var14 - 1] & 4) == 0) {
                        client.anIntArray7728[var26] = var11 - 1 | 1179648 | 1375731712;
                        client.anIntArray7729[var26] = var14 | 1245184;
                        var26 = var26 + 1 & 4095;
                        var6[-117136075 * Class181.anInt2197][var11 - 1][var14] = var7;
                     }

                     if(var6[-117136075 * Class181.anInt2197][var11][var14] != var7) {
                        client.anIntArray7728[var26] = var11 | 5373952 | 318767104;
                        client.anIntArray7729[var26] = var14 | 5439488;
                        var26 = var26 + 1 & 4095;
                        var6[-117136075 * Class181.anInt2197][var11][var14] = var7;
                     }

                     if(var11 + 1 < client.aClass279_7807.method4910(2079765862) && var6[Class181.anInt2197 * -117136075][1 + var11][var14] != var7 && (var8.aByteArrayArrayArray3028[-117136075 * Class181.anInt2197][var11][var14] & 4) == 0 && (var8.aByteArrayArrayArray3028[Class181.anInt2197 * -117136075][var11 + 1][var14 - 1] & 4) == 0) {
                        client.anIntArray7728[var26] = var11 + 1 | 5373952 | -1845493760;
                        client.anIntArray7729[var26] = var14 | 5439488;
                        var26 = 1 + var26 & 4095;
                        var6[-117136075 * Class181.anInt2197][1 + var11][var14] = var7;
                     }
                  }

                  --var14;
                  if(1 + var11 < client.aClass279_7807.method4910(1604356125) && var7 != var6[Class181.anInt2197 * -117136075][1 + var11][var14]) {
                     client.anIntArray7728[var26] = var11 + 1 | 9568256 | 1392508928;
                     client.anIntArray7729[var26] = var14 | 9633792;
                     var26 = var26 + 1 & 4095;
                     var6[Class181.anInt2197 * -117136075][var11 + 1][var14] = var7;
                  }

                  --var14;
                  if(var14 >= 0) {
                     if(var11 - 1 >= 0 && var6[-117136075 * Class181.anInt2197][var11 - 1][var14] != var7 && 0 == (var8.aByteArrayArrayArray3028[-117136075 * Class181.anInt2197][var11][var14] & 4) && (var8.aByteArrayArrayArray3028[Class181.anInt2197 * -117136075][var11 - 1][1 + var14] & 4) == 0) {
                        client.anIntArray7728[var26] = var11 - 1 | 13762560 | 301989888;
                        client.anIntArray7729[var26] = var14 | 13828096;
                        var26 = 1 + var26 & 4095;
                        var6[Class181.anInt2197 * -117136075][var11 - 1][var14] = var7;
                     }

                     if(var7 != var6[-117136075 * Class181.anInt2197][var11][var14]) {
                        client.anIntArray7728[var26] = var11 | 13762560 | -1828716544;
                        client.anIntArray7729[var26] = var14 | 13828096;
                        var26 = 1 + var26 & 4095;
                        var6[Class181.anInt2197 * -117136075][var11][var14] = var7;
                     }

                     if(1 + var11 < client.aClass279_7807.method4910(1575698060) && var6[-117136075 * Class181.anInt2197][var11 + 1][var14] != var7 && 0 == (var8.aByteArrayArrayArray3028[-117136075 * Class181.anInt2197][var11][var14] & 4) && 0 == (var8.aByteArrayArrayArray3028[-117136075 * Class181.anInt2197][var11 + 1][var14 + 1] & 4)) {
                        client.anIntArray7728[var26] = var11 + 1 | 9568256 | -771751936;
                        client.anIntArray7729[var26] = var14 | 9633792;
                        var26 = var26 + 1 & 4095;
                        var6[-117136075 * Class181.anInt2197][1 + var11][var14] = var7;
                     }
                  }
               }
            }

            if(-1000000 != client.anIntArray7787[var1]) {
               client.anIntArray7787[var1] += 40;
               client.anIntArray7788[var1] -= 512;
               client.anIntArray7789[var1] += 512;
               client.anIntArray7862[var1] += 512;
               client.anIntArray7791[var1] -= 512;
            }

            return true;
         }
      }
   }

   public static void method12204(int var0, String var1, int var2) {
      int var3 = Class184.anInt2209 * -583589671;
      int[] var4 = Class184.anIntArray2204;
      boolean var5 = false;

      for(int var6 = 0; var6 < var3; ++var6) {
         Class515_Sub1_Sub4_Sub4_Sub1 var7 = client.aClass515_Sub1_Sub4_Sub4_Sub1Array7799[var4[var6]];
         if(var7 != null && Class5.aClass515_Sub1_Sub4_Sub4_Sub1_113 != var7 && var7.aString10856 != null && var7.aString10856.equalsIgnoreCase(var1)) {
            OutgoingOpcode var8 = null;
            if(1 == var0) {
               var8 = OutgoingOpcode.aClass302_3830;
            } else if(4 == var0) {
               var8 = OutgoingOpcode.aClass302_3817;
            } else if(var0 == 5) {
               var8 = OutgoingOpcode.aClass302_3802;
            } else if(var0 == 6) {
               var8 = OutgoingOpcode.aClass302_3853;
            } else if(var0 == 7) {
               var8 = OutgoingOpcode.aClass302_3836;
            } else if(9 == var0) {
               var8 = OutgoingOpcode.aClass302_3834;
            }

            if(null != var8) {
               Class225_Sub15 var9 = Class543.method11415(var8, client.aClass180_7704.aClass433_2184, (byte)1);
               var9.buffer.method13743(0, -1861647021);
               var9.buffer.writeShortA(var4[var6], -594177384);
               client.aClass180_7704.method3191(var9, (byte)86);
            }

            var5 = true;
            break;
         }
      }

      if(!var5) {
         Class285.method5239(4, Class418.aClass418_5155.method7137(Class498.aClass470_5944, (byte)-27) + var1, (byte)31);
      }

   }

   static final void method12205(Class508 var0, int var1) {
      int var2 = var0.anIntArray6027[(var0.anInt6003 -= 98312473) * -937710807];
      Class124 var3 = Class97.method1903(var2, -1738595461);
      Class121 var4 = Class18.aClass121Array188[var2 >> 16];
      Class105.method2157(var3, var4, var0, (byte)1);
   }
}
