package mapped;

import java.awt.Polygon;
import java.awt.Shape;
import java.util.ArrayList;
import java.util.Iterator;
import net.runelite.api.HeadIcon;
import net.runelite.api.Perspective;
import net.runelite.api.SkullIcon;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.OverheadPrayerChanged;
import net.runelite.api.events.PlayerChanged;
import net.runelite.api.events.PlayerCompositionChanged;
import net.runelite.api.events.PlayerSkullChanged;
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.RSModel;
import net.runelite.rs.api.RSPlayer;
import net.runelite.rs.api.RSPlayerComposition;
import net.runelite.rs.api.RSUsername;

@ObfuscatedName("ds")
public final class Player extends Actor implements RSPlayer {
   @ObfuscatedName("ir")
   @ObfuscatedSignature(
      descriptor = "Liq;"
   )
   static Task field1125;
   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "Lvj;"
   )
   Username username;
   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "Lnb;"
   )
   PlayerComposition appearance;
   @ObfuscatedName("ar")
   @ObfuscatedGetter(
      intValue = -110809851
   )
   int headIconPk;
   @ObfuscatedName("ao")
   @ObfuscatedGetter(
      intValue = -262723037
   )
   int headIconPrayer;
   @ObfuscatedName("au")
   String[] actions;
   @ObfuscatedName("aa")
   @ObfuscatedGetter(
      intValue = 578825607
   )
   int combatLevel;
   @ObfuscatedName("ac")
   @ObfuscatedGetter(
      intValue = -1809832575
   )
   int skillLevel;
   @ObfuscatedName("al")
   @ObfuscatedGetter(
      intValue = -1976632803
   )
   int tileHeight;
   @ObfuscatedName("az")
   @ObfuscatedGetter(
      intValue = -1150711645
   )
   int animationCycleStart;
   @ObfuscatedName("ap")
   @ObfuscatedGetter(
      intValue = -2021409739
   )
   int animationCycleEnd;
   @ObfuscatedName("av")
   @ObfuscatedGetter(
      intValue = 613981459
   )
   int field1106;
   @ObfuscatedName("ax")
   @ObfuscatedGetter(
      intValue = -1369176927
   )
   int tileHeight2;
   @ObfuscatedName("as")
   @ObfuscatedGetter(
      intValue = -159661273
   )
   int field1108;
   @ObfuscatedName("ay")
   @ObfuscatedSignature(
      descriptor = "Lka;"
   )
   Model model0;
   @ObfuscatedName("ak")
   @ObfuscatedGetter(
      intValue = -1657474235
   )
   int minX;
   @ObfuscatedName("aj")
   @ObfuscatedGetter(
      intValue = -1355131803
   )
   int minY;
   @ObfuscatedName("am")
   @ObfuscatedGetter(
      intValue = 1460572105
   )
   int maxX;
   @ObfuscatedName("aq")
   @ObfuscatedGetter(
      intValue = -1149731389
   )
   int maxY;
   @ObfuscatedName("ai")
   boolean isUnanimated;
   @ObfuscatedName("aw")
   @ObfuscatedGetter(
      intValue = 1173843827
   )
   int team;
   @ObfuscatedName("ae")
   boolean isHidden;
   @ObfuscatedName("ag")
   @ObfuscatedGetter(
      intValue = 371254959
   )
   int plane;
   @ObfuscatedName("ad")
   @ObfuscatedGetter(
      intValue = -1363065099
   )
   int index;
   @ObfuscatedName("af")
   @ObfuscatedSignature(
      descriptor = "Lrw;"
   )
   TriBool isFriendTriBool;
   @ObfuscatedName("be")
   @ObfuscatedSignature(
      descriptor = "Lrw;"
   )
   TriBool isInFriendsChat;
   @ObfuscatedName("bd")
   @ObfuscatedSignature(
      descriptor = "Lrw;"
   )
   TriBool isInClanChat;
   @ObfuscatedName("bl")
   boolean field1122;
   @ObfuscatedName("bi")
   @ObfuscatedGetter(
      intValue = 488168873
   )
   int tileX;
   @ObfuscatedName("bv")
   @ObfuscatedGetter(
      intValue = -694970577
   )
   int tileY;
   public int oldHeadIcon;
   public boolean friended;
   public int oldSkullIcon;

   Player() {
      this.headIconPk = -1;
      this.skullChanged(-1);
      this.headIconPrayer = -1;
      this.prayerChanged(-1);
      this.actions = new String[3];

      for(int var1 = 0; var1 < 3; ++var1) {
         this.actions[var1] = "";
      }

      this.combatLevel = 0;
      this.skillLevel = 0;
      this.animationCycleStart = 0;
      this.animationCycleEnd = 0;
      this.isUnanimated = false;
      this.team = 0;
      this.isHidden = false;
      this.isFriendTriBool = TriBool.TriBool_unknown;
      this.isInFriendsChat = TriBool.TriBool_unknown;
      this.isInClanChat = TriBool.TriBool_unknown;
      this.field1122 = false;
   }

   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "(Luj;I)V",
      garbageValue = "722515666"
   )
   final void method2387(Buffer var1) {
      long var2 = this.getPlayerComposition() == null?0L:this.getPlayerComposition().getHash();
      this.copy$read(var1, 722515666);
      if(SpriteMask.client.isComparingAppearance() && this.getPlayerComposition().getHash() != var2) {
         SpriteMask.client.getCallbacks().post(new PlayerCompositionChanged(this));
      }

      this.postRead(var1);
   }

   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "(B)Lka;",
      garbageValue = "1"
   )
   protected final Model vmethod5504() {
      if(SpriteMask.client.isInterpolatePlayerAnimations() && this.getPoseAnimation() != 244) {
         int var1 = this.getActionFrame();
         int var2 = this.getPoseFrame();
         int var3 = this.getSpotAnimFrame();
         boolean var15 = false;

         Model var17;
         try {
            var15 = true;
            this.setActionFrame(Integer.MIN_VALUE | this.getActionFrameCycle() << 16 | var1);
            this.setPoseFrame(Integer.MIN_VALUE | this.getPoseFrameCycle() << 16 | var2);
            this.setSpotAnimFrame(Integer.MIN_VALUE | this.getSpotAnimationFrameCycle() << 16 | var3);
            Iterator var4 = this.getSpotAnims().iterator();

            while(true) {
               if(!var4.hasNext()) {
                  var17 = this.copy$getModel((byte)1);
                  var15 = false;
                  break;
               }

               net.runelite.api.ActorSpotAnim var5 = (net.runelite.api.ActorSpotAnim)var4.next();
               int var6 = var5.getFrame();
               if(var6 != -1) {
                  var5.setFrame(Integer.MIN_VALUE | var5.getCycle() << 16 | var6);
               }
            }
         } finally {
            if(var15) {
               this.setActionFrame(var1);
               this.setPoseFrame(var2);
               this.setSpotAnimFrame(var3);
               Iterator var10 = this.getSpotAnims().iterator();

               while(true) {
                  if(!var10.hasNext()) {
                     ;
                  } else {
                     net.runelite.api.ActorSpotAnim var11 = (net.runelite.api.ActorSpotAnim)var10.next();
                     int var12 = var11.getFrame();
                     if(var12 != -1) {
                        var11.setFrame(var12 & 65535);
                     }
                  }
               }
            }
         }

         this.setActionFrame(var1);
         this.setPoseFrame(var2);
         this.setSpotAnimFrame(var3);
         Iterator var13 = this.getSpotAnims().iterator();

         while(var13.hasNext()) {
            net.runelite.api.ActorSpotAnim var7 = (net.runelite.api.ActorSpotAnim)var13.next();
            int var8 = var7.getFrame();
            if(var8 != -1) {
               var7.setFrame(var8 & 65535);
            }
         }

         return (Model)var17;
      } else {
         return (Model)this.copy$getModel((byte)1);
      }
   }

   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "(I)Z",
      garbageValue = "-1713250919"
   )
   boolean isFriend_base() {
      if(this.isFriendTriBool == TriBool.TriBool_unknown) {
         this.checkIsFriend_base();
      }

      return this.isFriendTriBool == TriBool.TriBool_true;
   }

   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "(B)V",
      garbageValue = "-116"
   )
   void clearIsFriend_base() {
      this.isFriendTriBool = TriBool.TriBool_unknown;
   }

   @ObfuscatedName("ab")
   @ObfuscatedSignature(
      descriptor = "(B)V",
      garbageValue = "-14"
   )
   void checkIsFriend_base() {
      this.isFriendTriBool = class12.friendSystem.method1915(this.username)?TriBool.TriBool_true:TriBool.TriBool_false;
      this.updateFriended();
   }

   @ObfuscatedName("az")
   @ObfuscatedSignature(
      descriptor = "(B)Z",
      garbageValue = "14"
   )
   boolean isFriendsChatMember_base() {
      if(this.isInFriendsChat == TriBool.TriBool_unknown) {
         this.updateIsInFriendsChat_base();
      }

      return this.isInFriendsChat == TriBool.TriBool_true;
   }

   @ObfuscatedName("ap")
   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "1706221690"
   )
   void clearIsInFriendsChat_base() {
      this.isInFriendsChat = TriBool.TriBool_unknown;
   }

   @ObfuscatedName("av")
   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "1196848864"
   )
   void updateIsInFriendsChat_base() {
      this.isInFriendsChat = class20.friendsChat != null && class20.friendsChat.method8182(this.username)?TriBool.TriBool_true:TriBool.TriBool_false;
   }

   @ObfuscatedName("ax")
   @ObfuscatedSignature(
      descriptor = "(B)V",
      garbageValue = "115"
   )
   void updateIsInClanChat_base() {
      for(int var1 = 0; var1 < 4; ++var1) {
         if(Client.currentClanSettings[var1] != null && Client.currentClanSettings[var1].method3323_base(this.username.getName_base()) != -1 && var1 != 2) {
            this.isInClanChat = TriBool.TriBool_true;
            return;
         }
      }

      this.isInClanChat = TriBool.TriBool_false;
   }

   @ObfuscatedName("as")
   @ObfuscatedSignature(
      descriptor = "(B)V",
      garbageValue = "-20"
   )
   void method2394_base() {
      this.isInClanChat = TriBool.TriBool_unknown;
   }

   @ObfuscatedName("ay")
   @ObfuscatedSignature(
      descriptor = "(I)Z",
      garbageValue = "-2021409739"
   )
   boolean isClanMember_base() {
      if(this.isInClanChat == TriBool.TriBool_unknown) {
         this.updateIsInClanChat_base();
      }

      return this.isInClanChat == TriBool.TriBool_true;
   }

   @ObfuscatedName("ak")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "2046405362"
   )
   int transformedSize_base() {
      return this.appearance != null && this.appearance.npcTransformId != -1?VerticalAlignment.method3757(this.appearance.npcTransformId).size:1;
   }

   @ObfuscatedName("aj")
   @ObfuscatedSignature(
      descriptor = "(IILiz;I)V",
      garbageValue = "2103873992"
   )
   final void method2398_base(int var1, int var2, class228 var3) {
      if(super.sequence != -1 && DynamicObject.method2245(super.sequence).field2205 == 1) {
         super.sequence = -1;
         this.animationChanged(-1);
      }

      this.method2480_base();
      if(var1 >= 0 && var1 < 104 && var2 >= 0 && var2 < 104) {
         if(super.pathX[0] >= 0 && super.pathX[0] < 104 && super.pathY[0] >= 0 && super.pathY[0] < 104) {
            if(var3 == class228.field2410) {
               WorldMapCacheName.method5006(this, var1, var2, class228.field2410);
            }

            this.method2400_base(var1, var2, var3);
         } else {
            this.resetPath_base(var1, var2);
         }
      } else {
         this.resetPath_base(var1, var2);
      }

   }

   @ObfuscatedName("am")
   @ObfuscatedSignature(
      descriptor = "(III)V",
      garbageValue = "1104771167"
   )
   void resetPath_base(int var1, int var2) {
      super.pathLength = 0;
      super.field1220 = 0;
      super.field1245 = 0;
      super.pathX[0] = var1;
      super.pathY[0] = var2;
      int var3 = this.transformedSize_base();
      super.x = super.pathX[0] * 128 + var3 * 64;
      super.y = super.pathY[0] * 128 + var3 * 64;
   }

   @ObfuscatedName("aq")
   @ObfuscatedSignature(
      descriptor = "(IILiz;I)V",
      garbageValue = "1624897043"
   )
   final void method2400_base(int var1, int var2, class228 var3) {
      if(super.pathLength < 9) {
         ++super.pathLength;
      }

      for(int var4 = super.pathLength; var4 > 0; --var4) {
         super.pathX[var4] = super.pathX[var4 - 1];
         super.pathY[var4] = super.pathY[var4 - 1];
         super.pathTraversed[var4] = super.pathTraversed[var4 - 1];
      }

      super.pathX[0] = var1;
      super.pathY[0] = var2;
      super.pathTraversed[0] = var3;
   }

   @ObfuscatedName("ai")
   @ObfuscatedSignature(
      descriptor = "(I)Z",
      garbageValue = "1221291483"
   )
   final boolean isVisible_base() {
      return this.appearance != null;
   }

   public boolean isFriend() {
      return this.isFriend_base();
   }

   public RSUsername getRsName() {
      return this.username;
   }

   public RSPlayerComposition getPlayerComposition() {
      return this.appearance;
   }

   public int getRsOverheadIcon() {
      return this.headIconPrayer;
   }

   public int getRsSkullIcon() {
      return this.headIconPk;
   }

   public HeadIcon getHeadIcon(int var1) {
      return var1 == -1?null:HeadIcon.values()[var1];
   }

   public SkullIcon skullFromInt(int var1) {
      switch(var1) {
      case 0:
         return SkullIcon.SKULL;
      case 1:
         return SkullIcon.SKULL_FIGHT_PIT;
      case 2:
      case 3:
      case 4:
      case 5:
      case 6:
      case 7:
      default:
         return null;
      case 8:
         return SkullIcon.DEAD_MAN_FIVE;
      case 9:
         return SkullIcon.DEAD_MAN_FOUR;
      case 10:
         return SkullIcon.DEAD_MAN_THREE;
      case 11:
         return SkullIcon.DEAD_MAN_TWO;
      case 12:
         return SkullIcon.DEAD_MAN_ONE;
      }
   }

   @ObfuscatedSignature(
      descriptor = "(Luj;I)V",
      garbageValue = "722515666"
   )
   public final void copy$read(Buffer var1, int var2) {
      var1.offset = 0;
      int var3 = var1.readUnsignedByte_base();
      boolean var4 = true;
      this.headIconPk = var1.readByte_base();
      this.skullChanged(-1);
      this.headIconPrayer = var1.readByte_base();
      this.prayerChanged(-1);
      int var5 = -1;
      this.team = 0;
      int[] var6 = new int[12];

      int var8;
      int var9;
      int var10;
      for(int var7 = 0; var7 < 12; ++var7) {
         var8 = var1.readUnsignedByte_base();
         if(var8 == 0) {
            var6[var7] = 0;
         } else {
            var9 = var1.readUnsignedByte_base();
            var6[var7] = var9 + (var8 << 8);
            if(var7 == 0 && var6[0] == 65535) {
               var5 = var1.readUnsignedShort_base();
               break;
            }

            if(var6[var7] >= 512) {
               var10 = class214.method4226(var6[var7] - 512).team;
               if(var10 != 0) {
                  this.team = var10;
               }
            }
         }
      }

      int[] var14 = null;
      if(Client.revision >= 213) {
         var14 = new int[12];

         for(var8 = 0; var8 < 12; ++var8) {
            var9 = var1.readUnsignedByte_base();
            if(var9 == 0) {
               var14[var8] = 0;
            } else {
               var10 = var1.readUnsignedByte_base();
               var14[var8] = var10 + (var9 << 8);
            }
         }
      }

      int[] var15 = new int[5];

      for(var9 = 0; var9 < 5; ++var9) {
         var10 = var1.readUnsignedByte_base();
         if(var10 < 0 || var10 >= class90.field1094[var9].length) {
            var10 = 0;
         }

         var15[var9] = var10;
      }

      super.idleSequence = var1.readUnsignedShort_base();
      if(super.idleSequence == 65535) {
         super.idleSequence = -1;
      }

      super.turnLeftSequence = var1.readUnsignedShort_base();
      if(super.turnLeftSequence == 65535) {
         super.turnLeftSequence = -1;
      }

      super.turnRightSequence = super.turnLeftSequence;
      super.walkSequence = var1.readUnsignedShort_base();
      if(super.walkSequence == 65535) {
         super.walkSequence = -1;
      }

      super.walkBackSequence = var1.readUnsignedShort_base();
      if(super.walkBackSequence == 65535) {
         super.walkBackSequence = -1;
      }

      super.walkLeftSequence = var1.readUnsignedShort_base();
      if(super.walkLeftSequence == 65535) {
         super.walkLeftSequence = -1;
      }

      super.walkRightSequence = var1.readUnsignedShort_base();
      if(super.walkRightSequence == 65535) {
         super.walkRightSequence = -1;
      }

      super.runSequence = var1.readUnsignedShort_base();
      if(super.runSequence == 65535) {
         super.runSequence = -1;
      }

      this.username = new Username(var1.readStringCp1252NullTerminated_base(), class89.loginType);
      this.clearIsFriend_base();
      this.clearIsInFriendsChat_base();
      this.method2394_base();
      if(this == class229.localPlayer) {
         class17.field77 = this.username.getName_base();
         Client.sentryUser.setUsername(class17.field77);
      }

      this.combatLevel = var1.readUnsignedByte_base();
      this.skillLevel = var1.readUnsignedShort_base();
      this.isHidden = var1.readUnsignedByte_base() == 1;
      if(Client.gameBuild == 0 && Client.staffModLevel >= 2) {
         this.isHidden = false;
      }

      PlayerCompositionColorTextureOverride[] var16 = null;
      boolean var18 = false;
      int var11 = var1.readUnsignedShort_base();
      var18 = (var11 >> 15 & 1) == 1;
      int var12;
      if(var11 > 0 && var11 != 32768) {
         var16 = new PlayerCompositionColorTextureOverride[12];

         for(var12 = 0; var12 < 12; ++var12) {
            int var13 = var11 >> 12 - var12 & 1;
            if(var13 == 1) {
               var16[var12] = class306.method5916(var6[var12] - 512, var1);
            }
         }
      }

      for(var12 = 0; var12 < 3; ++var12) {
         this.actions[var12] = var1.readStringCp1252NullTerminated_base();
      }

      int var17 = var1.readUnsignedByte_base();
      if(this.appearance == null) {
         this.appearance = new PlayerComposition();
      }

      this.appearance.method6315(var14, var6, var16, var18, var15, var3, var5, var17);
   }

   @ObfuscatedSignature(
      descriptor = "(B)Lka;",
      garbageValue = "1"
   )
   public final Model copy$getModel(byte var1) {
      if(this.appearance == null) {
         return null;
      } else {
         SequenceDefinition var2 = super.sequence != -1 && super.sequenceDelay == 0?DynamicObject.method2245(super.sequence):null;
         SequenceDefinition var3 = super.movementSequence == -1 || this.isUnanimated || super.movementSequence == super.idleSequence && var2 != null?null:DynamicObject.method2245(super.movementSequence);
         Model var4 = this.appearance.method6322(var2, super.sequenceFrame, var3, super.movementFrame);
         if(var4 == null) {
            return null;
         } else {
            var4.calculateBoundsCylinder_base();
            super.defaultHeight = var4.height;
            int var5 = var4.indicesCount;
            if(!this.isUnanimated) {
               var4 = this.method2469(var4);
            }

            if(!this.isUnanimated && this.model0 != null) {
               if(Client.cycle >= this.animationCycleEnd) {
                  this.model0 = null;
               }

               if(Client.cycle >= this.animationCycleStart && Client.cycle < this.animationCycleEnd) {
                  Model var6 = this.model0;
                  var6.offsetBy_base(this.field1106 - super.x, this.tileHeight2 - this.tileHeight, this.field1108 - super.y);
                  if(super.orientation == 512) {
                     var6.rotateY90Ccw_base();
                     var6.rotateY90Ccw_base();
                     var6.rotateY90Ccw_base();
                  } else if(super.orientation == 1024) {
                     var6.rotateY90Ccw_base();
                     var6.rotateY90Ccw_base();
                  } else if(super.orientation == 1536) {
                     var6.rotateY90Ccw_base();
                  }

                  Model[] var7 = new Model[]{var4, var6};
                  var4 = new Model(var7, 2);
                  if(super.orientation == 512) {
                     var6.rotateY90Ccw_base();
                  } else if(super.orientation == 1024) {
                     var6.rotateY90Ccw_base();
                     var6.rotateY90Ccw_base();
                  } else if(super.orientation == 1536) {
                     var6.rotateY90Ccw_base();
                     var6.rotateY90Ccw_base();
                     var6.rotateY90Ccw_base();
                  }

                  var6.offsetBy_base(super.x - this.field1106, this.tileHeight - this.tileHeight2, super.y - this.field1108);
               }
            }

            var4.isSingleTile = true;
            if(super.field1237 != 0 && Client.cycle >= super.field1232 && Client.cycle < super.field1215) {
               var4.overrideHue = super.field1234;
               var4.overrideSaturation = super.field1235;
               var4.overrideLuminance = super.field1171;
               var4.overrideAmount = super.field1237;
               var4.field3006 = (short)var5;
            } else {
               var4.overrideAmount = 0;
            }

            return var4;
         }
      }
   }

   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "-1"
   )
   public void skullChanged(int var1) {
      SkullIcon var2 = this.skullFromInt(this.getRsSkullIcon());
      if(this.getRsSkullIcon() != this.oldSkullIcon) {
         SpriteMask.client.getCallbacks().post(new PlayerSkullChanged(this, this.skullFromInt(this.getRsSkullIcon()), var2));
      }

      this.oldSkullIcon = this.getRsSkullIcon();
   }

   public void updateFriended() {
      this.friended = SpriteMask.client.getFriendManager().isFriended(this.getRsName(), false);
   }

   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "-1"
   )
   public void prayerChanged(int var1) {
      if(this.getRsOverheadIcon() != this.oldHeadIcon) {
         HeadIcon var2 = this.getHeadIcon(this.getRsOverheadIcon());
         SpriteMask.client.getCallbacks().post(new OverheadPrayerChanged(this, this.getHeadIcon(this.oldHeadIcon), var2));
      }

      this.oldHeadIcon = this.getRsOverheadIcon();
   }

   public void postRead(RSBuffer var1) {
      SpriteMask.client.getCallbacks().post(new PlayerChanged(this));
   }

   public String getName() {
      RSUsername var1 = this.getRsName();
      if(var1 == null) {
         return null;
      } else {
         String var2 = var1.getName();
         return var2 == null?null:var2.replace(' ', ' ');
      }
   }

   public HeadIcon getOverheadIcon() {
      return this.getHeadIcon(this.getRsOverheadIcon());
   }

   public SkullIcon getSkullIcon() {
      return this.skullFromInt(this.getRsSkullIcon());
   }

   public Polygon[] getPolygons() {
      RSModel var1 = this.getModel();
      if(var1 == null) {
         return null;
      } else {
         int[] var2 = new int[var1.getVerticesCount()];
         int[] var3 = new int[var1.getVerticesCount()];
         int var4 = this.getX();
         int var5 = this.getY();
         int var6 = Perspective.getTileHeight(SpriteMask.client, new LocalPoint(var4, var5), SpriteMask.client.getPlane());
         Perspective.modelToCanvas(SpriteMask.client, var1.getVerticesCount(), var4, var5, var6, this.getCurrentOrientation(), var1.getVerticesX(), var1.getVerticesZ(), var1.getVerticesY(), var2, var3);
         ArrayList var7 = new ArrayList(var1.getFaceCount());
         int[] var8 = var1.getFaceIndices1();
         int[] var9 = var1.getFaceIndices2();
         int[] var10 = var1.getFaceIndices3();

         for(int var11 = 0; var11 < var1.getFaceCount(); ++var11) {
            int[] var12 = new int[]{var2[var8[var11]], var2[var9[var11]], var2[var10[var11]]};
            int[] var13 = new int[]{var3[var8[var11]], var3[var9[var11]], var3[var10[var11]]};
            var7.add(new Polygon(var12, var13, 3));
         }

         return (Polygon[])var7.toArray(new Polygon[0]);
      }
   }

   public Shape getConvexHull() {
      RSModel var1 = this.getModel();
      if(var1 == null) {
         return null;
      } else {
         int var2 = Perspective.getTileHeight(SpriteMask.client, new LocalPoint(this.getX(), this.getY()), SpriteMask.client.getPlane());
         return var1.getConvexHull(this.getX(), this.getY(), this.getCurrentOrientation(), var2);
      }
   }

   public boolean isFriended() {
      return this.isFriend() || this.friended;
   }

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

   public int getCombatLevel() {
      return this.combatLevel;
   }

   public int getTotalLevel() {
      return this.skillLevel;
   }

   public int getRSSkillLevel() {
      return this.skillLevel;
   }

   public int getTeam() {
      return this.team;
   }

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

   public int getPlayerId() {
      return this.index;
   }

   public boolean isFriendsChatMember() {
      return this.isFriendsChatMember_base();
   }

   public boolean isClanMember() {
      return this.isClanMember_base();
   }

   @ObfuscatedName("ah")
   @ObfuscatedSignature(
      descriptor = "(Ltz;III)I",
      garbageValue = "319825494"
   )
   static int method2444(IterableNodeHashTable var0, int var1, int var2) {
      if(var0 == null) {
         return var2;
      } else {
         IntegerNode var3 = (IntegerNode)var0.get((long)var1);
         return var3 == null?var2:var3.integer;
      }
   }

   @ObfuscatedName("aa")
   @ObfuscatedSignature(
      descriptor = "(IIIZII)J",
      garbageValue = "835421128"
   )
   public static long calculateTag_base(int var0, int var1, int var2, boolean var3, int var4) {
      long var5 = (long)((var0 & 127) << 0 | (var1 & 127) << 7 | (var2 & 3) << 14) | ((long)var4 & 4294967295L) << 17;
      if(var3) {
         var5 |= 65536L;
      }

      return var5;
   }

   @ObfuscatedName("ap")
   @ObfuscatedSignature(
      descriptor = "(CB)Z",
      garbageValue = "2"
   )
   public static boolean isDigit_base(char var0) {
      return var0 >= '0' && var0 <= '9';
   }
}
