<|start_filename|>injector/src/main/java/com/openosrs/injector/injectors/raw/CopyRuneLiteClasses.java<|end_filename|>
/*
 * Copyright (c) 2021, <NAME> <https://github.com/Owain94>
 * All rights reserved.
 *
 * This code is licensed under GPL3, see the complete license in
 * the LICENSE file in the root directory of this submodule.
 */
package com.openosrs.injector.injectors.raw;

import com.openosrs.injector.InjectUtil;
import com.openosrs.injector.injection.InjectData;
import com.openosrs.injector.injectors.AbstractInjector;
import java.util.List;
import java.util.ListIterator;
import net.runelite.asm.ClassFile;
import net.runelite.asm.Field;
import net.runelite.asm.Method;
import net.runelite.asm.Type;
import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.instructions.CheckCast;
import net.runelite.asm.attributes.code.instructions.GetField;
import net.runelite.asm.attributes.code.instructions.GetStatic;
import net.runelite.asm.attributes.code.instructions.InvokeSpecial;
import net.runelite.asm.attributes.code.instructions.InvokeStatic;
import net.runelite.asm.attributes.code.instructions.InvokeVirtual;
import net.runelite.asm.attributes.code.instructions.New;
import net.runelite.asm.attributes.code.instructions.PutField;
import net.runelite.asm.attributes.code.instructions.PutStatic;
import net.runelite.asm.pool.Class;
import net.runelite.asm.signature.Signature;
import org.objectweb.asm.Opcodes;

public class CopyRuneLiteClasses extends AbstractInjector
{
	private static final List<String> RUNELITE_OBJECTS = List.of(
		"RuneLiteObject",
		"RuneLiteIterableLinkDeque",
		"RuneLiteIterableNodeDeque",
		"RuneLiteIterableNodeHashTable",
		"RuneLiteMenuEntry"
	);

	public CopyRuneLiteClasses(InjectData inject)
	{
		super(inject);
	}

	public void inject()
	{
		for (String className : RUNELITE_OBJECTS)
		{
			ClassFile runeliteObjectVanilla = inject.vanilla.findClass(className);

			final ClassFile runeLiteObjectDeob = inject.getDeobfuscated()
				.findClass(className);

			if (runeliteObjectVanilla == null)
			{
				runeliteObjectVanilla = new ClassFile(inject.vanilla);
				runeliteObjectVanilla.setVersion(Opcodes.V1_8);
				runeliteObjectVanilla.setName(className);
				runeliteObjectVanilla.setAccess(runeLiteObjectDeob.getAccess());

				if (runeLiteObjectDeob.getParentClass() != null)
				{
					ClassFile deobClass = inject.getDeobfuscated().findClass(runeLiteObjectDeob.getParentClass().getName());

					if (deobClass != null)
					{
						runeliteObjectVanilla.setParentClass(inject.toVanilla(deobClass).getPoolClass());
					}
					else
					{
						runeliteObjectVanilla.setParentClass(runeLiteObjectDeob.getParentClass());
					}
				}

				inject.toVanilla.put(runeLiteObjectDeob, runeliteObjectVanilla);

				for (Class interfaze : runeLiteObjectDeob.getInterfaces())
				{
					runeliteObjectVanilla.getInterfaces().addInterface(interfaze);
				}

				for (Field field : runeLiteObjectDeob.getFields())
				{
					field.setType(InjectUtil.deobToVanilla(inject, field.getType()));
					runeliteObjectVanilla.addField(field);
				}

				for (Method method : runeLiteObjectDeob.getMethods())
				{
					transformMethod(method);
					runeliteObjectVanilla.addMethod(method);
				}

				inject.vanilla.addClass(runeliteObjectVanilla);
			}
		}
	}

	private void transformMethod(Method method)
	{
		method.setDescriptor(getObfuscatedSignature(method.getDescriptor()));

		Code code = method.getCode();

		if (code != null)
		{
			Instructions ins = code.getInstructions();
			for (ListIterator<Instruction> iterator = ins.listIterator(); iterator.hasNext(); )
			{
				Instruction i = iterator.next();

				if (i instanceof PutField)
				{
					net.runelite.asm.pool.Field field = ((PutField) i).getField();
					Field vanilla = findField(field);

					if (vanilla != null)
					{
						iterator.set(new PutField(ins, vanilla));
					}
					else
					{
						field.setType(getObfuscatedSignature(field.getType()));
						iterator.set(new PutField(ins, field));
					}
				}
				else if (i instanceof GetField)
				{
					net.runelite.asm.pool.Field field = ((GetField) i).getField();
					Field vanilla = findField(field);

					if (vanilla != null)
					{
						iterator.set(new GetField(ins, vanilla));
					}
					else
					{
						field.setType(getObfuscatedSignature(field.getType()));
						iterator.set(new GetField(ins, field));
					}
				}
				else if (i instanceof PutStatic)
				{
					net.runelite.asm.pool.Field field = ((PutStatic) i).getField();
					Field vanilla = findField(field);

					if (vanilla != null)
					{
						iterator.set(new PutStatic(ins, vanilla));
					}
					else
					{
						field.setType(getObfuscatedSignature(field.getType()));
						iterator.set(new PutStatic(ins, field));
					}
				}
				else if (i instanceof GetStatic)
				{
					net.runelite.asm.pool.Field field = ((GetStatic) i).getField();
					Field vanilla = findField(field);

					if (vanilla != null)
					{
						iterator.set(new GetStatic(ins, vanilla));
					}
					else
					{
						field.setType(getObfuscatedSignature(field.getType()));
						iterator.set(new GetStatic(ins, field));
					}
				}
				else if (i instanceof InvokeSpecial)
				{
					net.runelite.asm.pool.Method meth = ((InvokeSpecial) i).getMethod();
					Method vanilla = findMethod(meth, true);

					if (vanilla != null)
					{
						iterator.set(new InvokeSpecial(ins, vanilla));
					}
					else
					{
						meth.setType(getObfuscatedSignature(meth.getType()));
						iterator.set(new InvokeSpecial(ins, meth));
					}
				}
				else if (i instanceof InvokeStatic)
				{
					net.runelite.asm.pool.Method meth = ((InvokeStatic) i).getMethod();
					Method vanilla = findMethod(meth, false);

					if (vanilla != null)
					{
						iterator.set(new InvokeStatic(ins, vanilla));
					}
					else
					{
						meth.setType(getObfuscatedSignature(meth.getType()));
						iterator.set(new InvokeStatic(ins, meth));
					}
				}
				else if (i instanceof InvokeVirtual)
				{
					net.runelite.asm.pool.Method meth = ((InvokeVirtual) i).getMethod();
					Method vanilla = findMethod(meth, true);

					if (vanilla != null)
					{
						iterator.set(new InvokeVirtual(ins, vanilla));
					}
					else
					{
						meth.setType(getObfuscatedSignature(meth.getType()));
						iterator.set(new InvokeVirtual(ins, meth));
					}
				}
				else if (i instanceof New)
				{

					Class clazz = ((New) i).getNewClass();
					ClassFile deobClass = inject.getDeobfuscated().findClass(clazz.getName());

					if (deobClass != null)
					{
						iterator.set(new New(ins, inject.toVanilla(deobClass)));
					}
				}
				else if (i instanceof CheckCast)
				{
					CheckCast clazz = ((CheckCast) i);
					iterator.set(new CheckCast(ins, getObfuscatedSignature(clazz.getType_())));
				}
			}
		}
	}

	private Signature getObfuscatedSignature(Signature signature)
	{
		Signature.Builder builder = new Signature.Builder();

		for (int j = 0; j < signature.size(); ++j)
		{
			Type type = signature.getTypeOfArg(j);
			builder.addArgument(InjectUtil.deobToVanilla(inject, type));
		}

		builder.setReturnType(InjectUtil.deobToVanilla(inject, signature.getReturnValue()));

		return builder.build();
	}

	private Type getObfuscatedSignature(Type type)
	{
		return InjectUtil.deobToVanilla(inject, type);
	}

	private Method findMethod(net.runelite.asm.pool.Method meth, boolean notStatic)
	{
		try
		{
			return InjectUtil.findMethod(inject, meth.getName(), meth.getClazz().getName(), meth.getType()::equals, notStatic, false);
		}
		catch (Exception e)
		{
			return null;
		}
	}

	private Field findField(net.runelite.asm.pool.Field field)
	{
		try
		{
			return InjectUtil.findField(inject, field.getName(), field.getClazz().getName());
		}
		catch (Exception e)
		{
			return null;
		}
	}
}


<|start_filename|>runescape-client/src/main/java/NPC.java<|end_filename|>
import java.applet.Applet;
import java.net.URL;
import net.runelite.mapping.Export;
import net.runelite.mapping.Implements;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import netscape.javascript.JSObject;

@ObfuscatedName("cr")
@Implements("NPC")
public final class NPC extends Actor {
	@ObfuscatedName("b")
	@Export("javaVersion")
	public static String javaVersion;
	@ObfuscatedName("r")
	@ObfuscatedSignature(
		descriptor = "Lpl;"
	)
	@Export("rightTitleSprite")
	static SpritePixels rightTitleSprite;
	@ObfuscatedName("v")
	@ObfuscatedSignature(
		descriptor = "Lku;"
	)
	@Export("Widget_fontsArchive")
	static AbstractArchive Widget_fontsArchive;
	@ObfuscatedName("c")
	@ObfuscatedSignature(
		descriptor = "Lfi;"
	)
	@Export("definition")
	NPCComposition definition;

	NPC() {
	}

	@ObfuscatedName("c")
	@ObfuscatedSignature(
		descriptor = "(ILgj;I)V",
		garbageValue = "1330012132"
	)
	final void method2319(int var1, class185 var2) {
		int var3 = super.pathX[0];
		int var4 = super.pathY[0];
		if (var1 == 0) {
			--var3;
			++var4;
		}

		if (var1 == 1) {
			++var4;
		}

		if (var1 == 2) {
			++var3;
			++var4;
		}

		if (var1 == 3) {
			--var3;
		}

		if (var1 == 4) {
			++var3;
		}

		if (var1 == 5) {
			--var3;
			--var4;
		}

		if (var1 == 6) {
			--var4;
		}

		if (var1 == 7) {
			++var3;
			--var4;
		}

		if (super.sequence != -1 && UserComparator5.SequenceDefinition_get(super.sequence).field2097 == 1) {
			super.sequence = -1;
		}

		if (super.pathLength < 9) {
			++super.pathLength;
		}

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

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

	@ObfuscatedName("b")
	@ObfuscatedSignature(
		descriptor = "(I)Lgo;",
		garbageValue = "202861607"
	)
	@Export("getModel")
	protected final Model getModel() {
		if (this.definition == null) {
			return null;
		} else {
			SequenceDefinition var1 = super.sequence != -1 && super.sequenceDelay == 0 ? UserComparator5.SequenceDefinition_get(super.sequence) : null;
			SequenceDefinition var2 = super.movementSequence == -1 || super.idleSequence == super.movementSequence && var1 != null ? null : UserComparator5.SequenceDefinition_get(super.movementSequence);
			Model var3 = this.definition.getModel(var1, super.sequenceFrame, var2, super.movementFrame);
			if (var3 == null) {
				return null;
			} else {
				var3.calculateBoundsCylinder();
				super.defaultHeight = var3.height;
				if (super.spotAnimation != -1 && super.spotAnimationFrame != -1) {
					Model var4 = AccessFile.SpotAnimationDefinition_get(super.spotAnimation).getModel(super.spotAnimationFrame);
					if (var4 != null) {
						var4.offsetBy(0, -super.field1131, 0);
						Model[] var5 = new Model[]{var3, var4};
						var3 = new Model(var5, 2);
					}
				}

				if (this.definition.size == 1) {
					var3.isSingleTile = true;
				}

				if (super.field1146 != 0 && Client.cycle >= super.field1141 && Client.cycle < super.field1140) {
					var3.overrideHue = super.field1143;
					var3.overrideSaturation = super.field1144;
					var3.overrideLuminance = super.field1095;
					var3.overrideAmount = super.field1146;
				} else {
					var3.overrideAmount = 0;
				}

				return var3;
			}
		}
	}

	@ObfuscatedName("p")
	@ObfuscatedSignature(
		descriptor = "(IIZI)V",
		garbageValue = "-2138088750"
	)
	final void method2315(int var1, int var2, boolean var3) {
		if (super.sequence != -1 && UserComparator5.SequenceDefinition_get(super.sequence).field2097 == 1) {
			super.sequence = -1;
		}

		if (!var3) {
			int var4 = var1 - super.pathX[0];
			int var5 = var2 - super.pathY[0];
			if (var4 >= -8 && var4 <= 8 && var5 >= -8 && var5 <= 8) {
				if (super.pathLength < 9) {
					++super.pathLength;
				}

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

				super.pathX[0] = var1;
				super.pathY[0] = var2;
				super.pathTraversed[0] = class185.field2123;
				return;
			}
		}

		super.pathLength = 0;
		super.field1098 = 0;
		super.field1117 = 0;
		super.pathX[0] = var1;
		super.pathY[0] = var2;
		super.x = super.field1120 * 64 + super.pathX[0] * 128;
		super.y = super.pathY[0] * 128 + super.field1120 * 64;
	}

	@ObfuscatedName("f")
	@ObfuscatedSignature(
		descriptor = "(B)Z",
		garbageValue = "1"
	)
	@Export("isVisible")
	final boolean isVisible() {
		return this.definition != null;
	}

	@ObfuscatedName("b")
	@ObfuscatedSignature(
		descriptor = "(Ljava/lang/String;ILjava/lang/String;B)Z",
		garbageValue = "68"
	)
	static boolean method2314(String var0, int var1, String var2) {
		if (var1 == 0) {
			try {
				if (!class29.field177.startsWith("win")) {
					throw new Exception();
				} else if (!var0.startsWith("http://") && !var0.startsWith("https://")) {
					throw new Exception();
				} else {
					String var11 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?&=,.%+-_#:/*";

					for (int var4 = 0; var4 < var0.length(); ++var4) {
						if (var11.indexOf(var0.charAt(var4)) == -1) {
							throw new Exception();
						}
					}

					Runtime.getRuntime().exec("cmd /c start \"j\" \"" + var0 + "\"");
					return true;
				}
			} catch (Throwable var5) {
				return false;
			}
		} else if (var1 == 1) {
			try {
				Object var10 = class27.method433(class29.field172, var2, new Object[]{(new URL(class29.field172.getCodeBase(), var0)).toString()});
				return var10 != null;
			} catch (Throwable var6) {
				return false;
			}
		} else if (var1 == 2) {
			try {
				class29.field172.getAppletContext().showDocument(new URL(class29.field172.getCodeBase(), var0), "_blank");
				return true;
			} catch (Exception var7) {
				return false;
			}
		} else if (var1 == 3) {
			try {
				Applet var3 = class29.field172;
				JSObject.getWindow(var3).call("loggedout", (Object[])null);
			} catch (Throwable var9) {
			}

			try {
				class29.field172.getAppletContext().showDocument(new URL(class29.field172.getCodeBase(), var0), "_top");
				return true;
			} catch (Exception var8) {
				return false;
			}
		} else {
			throw new IllegalArgumentException();
		}
	}
}


<|start_filename|>runescape-client/src/main/java/Player.java<|end_filename|>
import net.runelite.mapping.Export;
import net.runelite.mapping.Implements;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;

@ObfuscatedName("ck")
@Implements("Player")
public final class Player extends Actor {
	@ObfuscatedName("c")
	@ObfuscatedSignature(
		descriptor = "Lpo;"
	)
	@Export("username")
	Username username;
	@ObfuscatedName("b")
	@ObfuscatedSignature(
		descriptor = "Ljo;"
	)
	@Export("appearance")
	PlayerComposition appearance;
	@ObfuscatedName("p")
	@ObfuscatedGetter(
		intValue = -547248219
	)
	@Export("headIconPk")
	int headIconPk;
	@ObfuscatedName("m")
	@ObfuscatedGetter(
		intValue = -1687298057
	)
	@Export("headIconPrayer")
	int headIconPrayer;
	@ObfuscatedName("s")
	@Export("actions")
	String[] actions;
	@ObfuscatedName("j")
	@ObfuscatedGetter(
		intValue = 878255091
	)
	@Export("combatLevel")
	int combatLevel;
	@ObfuscatedName("w")
	@ObfuscatedGetter(
		intValue = -423854961
	)
	@Export("skillLevel")
	int skillLevel;
	@ObfuscatedName("n")
	@ObfuscatedGetter(
		intValue = 1513601945
	)
	@Export("tileHeight")
	int tileHeight;
	@ObfuscatedName("r")
	@ObfuscatedGetter(
		intValue = 1398284239
	)
	@Export("animationCycleStart")
	int animationCycleStart;
	@ObfuscatedName("o")
	@ObfuscatedGetter(
		intValue = -870222811
	)
	@Export("animationCycleEnd")
	int animationCycleEnd;
	@ObfuscatedName("v")
	@ObfuscatedGetter(
		intValue = -1880432377
	)
	int field1056;
	@ObfuscatedName("d")
	@ObfuscatedGetter(
		intValue = 624676029
	)
	@Export("tileHeight2")
	int tileHeight2;
	@ObfuscatedName("h")
	@ObfuscatedGetter(
		intValue = 1704388603
	)
	int field1058;
	@ObfuscatedName("g")
	@ObfuscatedSignature(
		descriptor = "Lgo;"
	)
	@Export("model0")
	Model model0;
	@ObfuscatedName("e")
	@ObfuscatedGetter(
		intValue = -1828058055
	)
	@Export("minX")
	int minX;
	@ObfuscatedName("a")
	@ObfuscatedGetter(
		intValue = -252077857
	)
	@Export("minY")
	int minY;
	@ObfuscatedName("u")
	@ObfuscatedGetter(
		intValue = -1520865497
	)
	@Export("maxX")
	int maxX;
	@ObfuscatedName("k")
	@ObfuscatedGetter(
		intValue = 639738043
	)
	@Export("maxY")
	int maxY;
	@ObfuscatedName("f")
	@Export("isUnanimated")
	boolean isUnanimated;
	@ObfuscatedName("l")
	@ObfuscatedGetter(
		intValue = 826351973
	)
	@Export("team")
	int team;
	@ObfuscatedName("q")
	@Export("isHidden")
	boolean isHidden;
	@ObfuscatedName("x")
	@ObfuscatedGetter(
		intValue = 1303296439
	)
	@Export("plane")
	int plane;
	@ObfuscatedName("z")
	@ObfuscatedGetter(
		intValue = 1488352927
	)
	@Export("index")
	int index;
	@ObfuscatedName("i")
	@ObfuscatedSignature(
		descriptor = "Lmu;"
	)
	@Export("isFriendTriBool")
	TriBool isFriendTriBool;
	@ObfuscatedName("y")
	@ObfuscatedSignature(
		descriptor = "Lmu;"
	)
	@Export("isInFriendsChat")
	TriBool isInFriendsChat;
	@ObfuscatedName("ah")
	@ObfuscatedSignature(
		descriptor = "Lmu;"
	)
	@Export("isInClanChat")
	TriBool isInClanChat;
	@ObfuscatedName("ao")
	boolean field1055;
	@ObfuscatedName("ab")
	@ObfuscatedGetter(
		intValue = -869781509
	)
	@Export("tileX")
	int tileX;
	@ObfuscatedName("ax")
	@ObfuscatedGetter(
		intValue = 1571518459
	)
	@Export("tileY")
	int tileY;

	Player() {
		this.headIconPk = -1;
		this.headIconPrayer = -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.field1055 = false;
	}

	@ObfuscatedName("c")
	@ObfuscatedSignature(
		descriptor = "(Lpi;I)V",
		garbageValue = "-1789639005"
	)
	@Export("read")
	final void read(Buffer var1) {
		var1.offset = 0;
		int var2 = var1.readUnsignedByte();
		this.headIconPk = var1.readByte();
		this.headIconPrayer = var1.readByte();
		int var3 = -1;
		this.team = 0;
		int[] var4 = new int[12];

		int var6;
		int var7;
		int var8;
		for (int var5 = 0; var5 < 12; ++var5) {
			var6 = var1.readUnsignedByte();
			if (var6 == 0) {
				var4[var5] = 0;
			} else {
				var7 = var1.readUnsignedByte();
				var4[var5] = var7 + (var6 << 8);
				if (var5 == 0 && var4[0] == 65535) {
					var3 = var1.readUnsignedShort();
					break;
				}

				if (var4[var5] >= 512) {
					var8 = UserComparator6.ItemDefinition_get(var4[var5] - 512).team;
					if (var8 != 0) {
						this.team = var8;
					}
				}
			}
		}

		int[] var11 = new int[5];

		for (var6 = 0; var6 < 5; ++var6) {
			var7 = var1.readUnsignedByte();
			if (var7 < 0 || var7 >= class114.field1382[var6].length) {
				var7 = 0;
			}

			var11[var6] = var7;
		}

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

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

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

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

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

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

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

		this.username = new Username(var1.readStringCp1252NullTerminated(), class194.loginType);
		this.clearIsFriend();
		this.clearIsInFriendsChat();
		this.method2186();
		if (this == class340.localPlayer) {
			RunException.localPlayerName = this.username.getName();
		}

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

		class160[] var12 = null;
		boolean var13 = false;
		if (var1.offset < var1.array.length) {
			var8 = var1.readUnsignedShort();
			var13 = (var8 >> 15 & 1) == 1;
			if (var8 > 0 && var8 != 32768) {
				var12 = new class160[12];

				for (int var9 = 0; var9 < 12; ++var9) {
					int var10 = var8 >> 12 - var9 & 1;
					if (var10 == 1) {
						var12[var9] = ClanChannelMember.method2777(var4[var9] - 512, var1);
					}
				}
			}
		}

		if (this.appearance == null) {
			this.appearance = new PlayerComposition();
		}

		this.appearance.method5368(var4, var12, var13, var11, var2 == 1, var3);
	}

	@ObfuscatedName("b")
	@ObfuscatedSignature(
		descriptor = "(I)Lgo;",
		garbageValue = "202861607"
	)
	@Export("getModel")
	protected final Model getModel() {
		if (this.appearance == null) {
			return null;
		} else {
			SequenceDefinition var1 = super.sequence != -1 && super.sequenceDelay == 0 ? UserComparator5.SequenceDefinition_get(super.sequence) : null;
			SequenceDefinition var2 = super.movementSequence == -1 || this.isUnanimated || super.idleSequence == super.movementSequence && var1 != null ? null : UserComparator5.SequenceDefinition_get(super.movementSequence);
			Model var3 = this.appearance.getModel(var1, super.sequenceFrame, var2, super.movementFrame);
			if (var3 == null) {
				return null;
			} else {
				var3.calculateBoundsCylinder();
				super.defaultHeight = var3.height;
				Model var4;
				Model[] var5;
				if (!this.isUnanimated && super.spotAnimation != -1 && super.spotAnimationFrame != -1) {
					var4 = AccessFile.SpotAnimationDefinition_get(super.spotAnimation).getModel(super.spotAnimationFrame);
					if (var4 != null) {
						var4.offsetBy(0, -super.field1131, 0);
						var5 = new Model[]{var3, var4};
						var3 = new Model(var5, 2);
					}
				}

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

					if (Client.cycle >= this.animationCycleStart && Client.cycle < this.animationCycleEnd) {
						var4 = this.model0;
						var4.offsetBy(this.field1056 - super.x, this.tileHeight2 - this.tileHeight, this.field1058 - super.y);
						if (super.orientation == 512) {
							var4.rotateY90Ccw();
							var4.rotateY90Ccw();
							var4.rotateY90Ccw();
						} else if (super.orientation == 1024) {
							var4.rotateY90Ccw();
							var4.rotateY90Ccw();
						} else if (super.orientation == 1536) {
							var4.rotateY90Ccw();
						}

						var5 = new Model[]{var3, var4};
						var3 = new Model(var5, 2);
						if (super.orientation == 512) {
							var4.rotateY90Ccw();
						} else if (super.orientation == 1024) {
							var4.rotateY90Ccw();
							var4.rotateY90Ccw();
						} else if (super.orientation == 1536) {
							var4.rotateY90Ccw();
							var4.rotateY90Ccw();
							var4.rotateY90Ccw();
						}

						var4.offsetBy(super.x - this.field1056, this.tileHeight - this.tileHeight2, super.y - this.field1058);
					}
				}

				var3.isSingleTile = true;
				if (super.field1146 != 0 && Client.cycle >= super.field1141 && Client.cycle < super.field1140) {
					var3.overrideHue = super.field1143;
					var3.overrideSaturation = super.field1144;
					var3.overrideLuminance = super.field1095;
					var3.overrideAmount = super.field1146;
				} else {
					var3.overrideAmount = 0;
				}

				return var3;
			}
		}
	}

	@ObfuscatedName("p")
	@ObfuscatedSignature(
		descriptor = "(I)Z",
		garbageValue = "-373800926"
	)
	@Export("isFriend")
	boolean isFriend() {
		if (this.isFriendTriBool == TriBool.TriBool_unknown) {
			this.checkIsFriend();
		}

		return this.isFriendTriBool == TriBool.TriBool_true;
	}

	@ObfuscatedName("m")
	@ObfuscatedSignature(
		descriptor = "(B)V",
		garbageValue = "7"
	)
	@Export("clearIsFriend")
	void clearIsFriend() {
		this.isFriendTriBool = TriBool.TriBool_unknown;
	}

	@ObfuscatedName("t")
	@ObfuscatedSignature(
		descriptor = "(I)V",
		garbageValue = "1903452676"
	)
	@Export("checkIsFriend")
	void checkIsFriend() {
		this.isFriendTriBool = GameEngine.friendSystem.isFriendAndHasWorld(this.username) ? TriBool.TriBool_true : TriBool.TriBool_false;
	}

	@ObfuscatedName("r")
	@ObfuscatedSignature(
		descriptor = "(B)Z",
		garbageValue = "111"
	)
	@Export("isFriendsChatMember")
	boolean isFriendsChatMember() {
		if (this.isInFriendsChat == TriBool.TriBool_unknown) {
			this.updateIsInFriendsChat();
		}

		return this.isInFriendsChat == TriBool.TriBool_true;
	}

	@ObfuscatedName("o")
	@ObfuscatedSignature(
		descriptor = "(I)V",
		garbageValue = "1186540924"
	)
	@Export("clearIsInFriendsChat")
	void clearIsInFriendsChat() {
		this.isInFriendsChat = TriBool.TriBool_unknown;
	}

	@ObfuscatedName("v")
	@ObfuscatedSignature(
		descriptor = "(B)V",
		garbageValue = "76"
	)
	@Export("updateIsInFriendsChat")
	void updateIsInFriendsChat() {
		this.isInFriendsChat = Players.friendsChat != null && Players.friendsChat.contains(this.username) ? TriBool.TriBool_true : TriBool.TriBool_false;
	}

	@ObfuscatedName("d")
	@ObfuscatedSignature(
		descriptor = "(I)V",
		garbageValue = "-1789868613"
	)
	@Export("updateIsInClanChat")
	void updateIsInClanChat() {
		for (int var1 = 0; var1 < 2; ++var1) {
			if (Client.currentClanSettings[var1] != null && Client.currentClanSettings[var1].method2881(this.username.getName()) != -1) {
				this.isInClanChat = TriBool.TriBool_true;
				return;
			}
		}

		this.isInClanChat = TriBool.TriBool_false;
	}

	@ObfuscatedName("h")
	@ObfuscatedSignature(
		descriptor = "(I)V",
		garbageValue = "-782154637"
	)
	void method2186() {
		this.isInClanChat = TriBool.TriBool_unknown;
	}

	@ObfuscatedName("g")
	@ObfuscatedSignature(
		descriptor = "(I)Z",
		garbageValue = "98044476"
	)
	@Export("isClanMember")
	boolean isClanMember() {
		if (this.isInClanChat == TriBool.TriBool_unknown) {
			this.updateIsInClanChat();
		}

		return this.isInClanChat == TriBool.TriBool_true;
	}

	@ObfuscatedName("e")
	@ObfuscatedSignature(
		descriptor = "(I)I",
		garbageValue = "1145675774"
	)
	@Export("transformedSize")
	int transformedSize() {
		return this.appearance != null && this.appearance.npcTransformId != -1 ? WorldMapLabelSize.getNpcDefinition(this.appearance.npcTransformId).size : 1;
	}

	@ObfuscatedName("a")
	@ObfuscatedSignature(
		descriptor = "(IILgj;I)V",
		garbageValue = "-1031926598"
	)
	final void method2175(int var1, int var2, class185 var3) {
		if (super.sequence != -1 && UserComparator5.SequenceDefinition_get(super.sequence).field2097 == 1) {
			super.sequence = -1;
		}

		super.field1122 = -1;
		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 == class185.field2122) {
					Archive.method5586(this, var1, var2, class185.field2122);
				}

				this.method2177(var1, var2, var3);
			} else {
				this.resetPath(var1, var2);
			}
		} else {
			this.resetPath(var1, var2);
		}

	}

	@ObfuscatedName("u")
	@ObfuscatedSignature(
		descriptor = "(III)V",
		garbageValue = "625623334"
	)
	@Export("resetPath")
	void resetPath(int var1, int var2) {
		super.pathLength = 0;
		super.field1098 = 0;
		super.field1117 = 0;
		super.pathX[0] = var1;
		super.pathY[0] = var2;
		int var3 = this.transformedSize();
		super.x = super.pathX[0] * 128 + var3 * 64;
		super.y = var3 * 64 + super.pathY[0] * 128;
	}

	@ObfuscatedName("k")
	@ObfuscatedSignature(
		descriptor = "(IILgj;I)V",
		garbageValue = "1075045053"
	)
	final void method2177(int var1, int var2, class185 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("f")
	@ObfuscatedSignature(
		descriptor = "(B)Z",
		garbageValue = "1"
	)
	@Export("isVisible")
	final boolean isVisible() {
		return this.appearance != null;
	}
}
