package mapped;

import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.geom.Area;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.TileObject;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSGameObject;
import net.runelite.rs.api.RSItemLayer;
import net.runelite.rs.api.RSRenderable;

@ObfuscatedName("kj")
public final class ItemLayer implements RSItemLayer, TileObject {
   @ObfuscatedName("ht")
   static String field2655;
   @ObfuscatedName("jv")
   @ObfuscatedSignature(
      descriptor = "Lpf;"
   )
   static Font fontPlain12;
   @ObfuscatedName("kr")
   @ObfuscatedSignature(
      descriptor = "Luz;"
   )
   static SpritePixels compass;
   @ObfuscatedName("mr")
   @ObfuscatedGetter(
      intValue = -825074063
   )
   static int Client_plane;
   @ObfuscatedName("at")
   @ObfuscatedGetter(
      intValue = -162293575
   )
   int z;
   @ObfuscatedName("ah")
   @ObfuscatedGetter(
      intValue = 195005795
   )
   int x;
   @ObfuscatedName("ar")
   int y;
   @ObfuscatedName("ao")
   @ObfuscatedSignature(
      descriptor = "Lkt;"
   )
   Renderable first;
   @ObfuscatedName("ab")
   @ObfuscatedSignature(
      descriptor = "Lkt;"
   )
   Renderable second;
   @ObfuscatedName("au")
   @ObfuscatedSignature(
      descriptor = "Lkt;"
   )
   Renderable third;
   @ObfuscatedName("aa")
   @ObfuscatedGetter(
      longValue = -3344454084756600557L
   )
   long tag;
   @ObfuscatedName("ac")
   @ObfuscatedGetter(
      intValue = -1481862157
   )
   int height;
   public int itemLayerPlane;

   public Area getClickbox() {
      throw new UnsupportedOperationException();
   }

   public Point getCanvasLocation(int var1) {
      return Perspective.localToCanvas(SpriteMask.client, this.getLocalLocation(), this.getPlane(), var1);
   }

   public RSRenderable getTop() {
      return this.first;
   }

   public RSRenderable getMiddle() {
      return this.second;
   }

   public RSRenderable getBottom() {
      return this.third;
   }

   public long getHash() {
      return this.tag;
   }

   public int getX() {
      return this.x;
   }

   public int getId() {
      long var1 = this.getHash();
      return (int)(var1 >>> 17 & 4294967295L);
   }

   public LocalPoint getLocalLocation() {
      return new LocalPoint(this.getX(), this.getY());
   }

   public int getY() {
      return this.y * 185597952;
   }

   public int getPlane() {
      return this.itemLayerPlane;
   }

   public void setPlane(int var1) {
      this.itemLayerPlane = var1;
   }

   public net.runelite.api.Model getModelTop() {
      RSRenderable var1 = this.getTop();
      return var1 == null?null:(var1 instanceof net.runelite.api.Model?(net.runelite.api.Model)var1:var1.getModel());
   }

   public net.runelite.api.Model getModelMiddle() {
      RSRenderable var1 = this.getMiddle();
      return var1 == null?null:(var1 instanceof net.runelite.api.Model?(net.runelite.api.Model)var1:var1.getModel());
   }

   public net.runelite.api.Model getModelBottom() {
      RSRenderable var1 = this.getBottom();
      return var1 == null?null:(var1 instanceof net.runelite.api.Model?(net.runelite.api.Model)var1:var1.getModel());
   }

   public String getName() {
      return SpriteMask.client.getObjectDefinition(this.getId()).getName();
   }

   public String[] getActions() {
      return SpriteMask.client.getObjectDefinition(this.getId()).getActions();
   }

   public WorldPoint getWorldLocation() {
      return WorldPoint.fromLocal(SpriteMask.client, this.getX(), this.getY(), this.getPlane());
   }

   public Point getCanvasLocation() {
      return this.getCanvasLocation(0);
   }

   public Polygon getCanvasTilePoly() {
      int var1 = 1;
      int var2 = 1;

      return Perspective.getCanvasTileAreaPoly(SpriteMask.client, this.getLocalLocation(), var1, var2, this.getPlane(), 0);
   }

   public Point getCanvasTextLocation(Graphics2D var1, String var2, int var3) {
      return Perspective.getCanvasTextLocation(SpriteMask.client, var1, this.getLocalLocation(), var2, var3);
   }

   public Point getMinimapLocation() {
      return Perspective.localToMinimap(SpriteMask.client, this.getLocalLocation());
   }

   public int getZ() {
      return this.z;
   }

   public int getHeight() {
      return this.height;
   }
}
