Files
runelite/runescape-client/src/main/java/AbstractWorldMapIcon.java
2020-10-04 21:08:08 -04:00

218 lines
5.2 KiB
Java

import java.io.File;
import java.io.RandomAccessFile;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
@ObfuscatedName("az")
public abstract class AbstractWorldMapIcon {
@ObfuscatedName("h")
@ObfuscatedSignature(
descriptor = "Lfa;"
)
static Clock clock;
@ObfuscatedName("bp")
@ObfuscatedSignature(
descriptor = "[Lls;"
)
static IndexedSprite[] worldSelectFlagSprites;
@ObfuscatedName("x")
@ObfuscatedSignature(
descriptor = "Lhg;"
)
public final Coord coord2;
@ObfuscatedName("w")
@ObfuscatedSignature(
descriptor = "Lhg;"
)
public final Coord coord1;
@ObfuscatedName("g")
@ObfuscatedGetter(
intValue = 857445445
)
int screenX;
@ObfuscatedName("m")
@ObfuscatedGetter(
intValue = -161924757
)
int screenY;
@ObfuscatedSignature(
descriptor = "(Lhg;Lhg;)V"
)
AbstractWorldMapIcon(Coord var1, Coord var2) {
this.coord1 = var1; // L: 13
this.coord2 = var2; // L: 14
} // L: 15
@ObfuscatedName("z")
@ObfuscatedSignature(
descriptor = "(I)I",
garbageValue = "-1613828162"
)
public abstract int getElement();
@ObfuscatedName("k")
@ObfuscatedSignature(
descriptor = "(I)Laq;",
garbageValue = "499378708"
)
abstract WorldMapLabel getLabel();
@ObfuscatedName("s")
@ObfuscatedSignature(
descriptor = "(I)I",
garbageValue = "182515130"
)
abstract int getSubWidth();
@ObfuscatedName("t")
@ObfuscatedSignature(
descriptor = "(I)I",
garbageValue = "-2001682063"
)
abstract int getSubHeight();
@ObfuscatedName("q")
@ObfuscatedSignature(
descriptor = "(III)Z",
garbageValue = "1932387399"
)
boolean fitsScreen(int var1, int var2) {
if (this.elementFitsScreen(var1, var2)) { // L: 18
return true; // L: 19
} else {
return this.labelFitsScreen(var1, var2); // L: 21
}
}
@ObfuscatedName("c")
@ObfuscatedSignature(
descriptor = "(I)Z",
garbageValue = "-446281234"
)
boolean hasValidElement() {
return this.getElement() >= 0;
}
@ObfuscatedName("j")
@ObfuscatedSignature(
descriptor = "(IIB)Z",
garbageValue = "-125"
)
boolean elementFitsScreen(int var1, int var2) {
if (!this.hasValidElement()) {
return false;
} else {
WorldMapElement var3 = WorldMapSection0.WorldMapElement_get(this.getElement()); // L: 38
int var4 = this.getSubWidth(); // L: 39
int var5 = this.getSubHeight(); // L: 40
switch(var3.horizontalAlignment.value) {
case 0:
if (var1 < this.screenX - var4 / 2 || var1 > var4 / 2 + this.screenX) { // L: 44
return false;
}
break;
case 1:
if (var1 <= this.screenX - var4 || var1 > this.screenX) { // L: 54
return false;
}
break;
case 2:
if (var1 < this.screenX || var1 >= var4 + this.screenX) { // L: 49
return false;
}
}
switch(var3.verticalAlignment.value) { // L: 58
case 0:
if (var2 < this.screenY - var5 / 2 || var2 > var5 / 2 + this.screenY) { // L: 61
return false;
}
break;
case 1:
if (var2 <= this.screenY - var5 || var2 > this.screenY) { // L: 66
return false;
}
break;
case 2:
if (var2 < this.screenY || var2 >= var5 + this.screenY) { // L: 71
return false;
}
}
return true; // L: 75
}
}
@ObfuscatedName("r")
@ObfuscatedSignature(
descriptor = "(III)Z",
garbageValue = "706174732"
)
boolean labelFitsScreen(int var1, int var2) {
WorldMapLabel var3 = this.getLabel(); // L: 79
if (var3 == null) { // L: 80
return false; // L: 81
} else if (var1 >= this.screenX - var3.width / 2 && var1 <= var3.width / 2 + this.screenX) { // L: 83
return var2 >= this.screenY && var2 <= this.screenY + var3.height; // L: 84
} else {
return false; // L: 85
}
}
@ObfuscatedName("z")
@ObfuscatedSignature(
descriptor = "(I)[Lcd;",
garbageValue = "1037177959"
)
static AttackOption[] method679() {
return new AttackOption[]{AttackOption.AttackOption_leftClickWhereAvailable, AttackOption.AttackOption_hidden, AttackOption.AttackOption_dependsOnCombatLevels, AttackOption.AttackOption_alwaysRightClick}; // L: 10925
}
@ObfuscatedName("k")
@ObfuscatedSignature(
descriptor = "(Ljava/lang/String;I)Ljava/io/File;",
garbageValue = "379993437"
)
static File getFile(String var0) {
if (!FileSystem.FileSystem_hasPermissions) { // L: 22
throw new RuntimeException("");
} else {
File var1 = (File)FileSystem.FileSystem_cacheFiles.get(var0); // L: 23
if (var1 != null) { // L: 24
return var1;
} else {
File var2 = new File(FileSystem.FileSystem_cacheDir, var0); // L: 25
RandomAccessFile var3 = null; // L: 26
try {
File var4 = new File(var2.getParent()); // L: 28
if (!var4.exists()) { // L: 29
throw new RuntimeException("");
} else {
var3 = new RandomAccessFile(var2, "rw"); // L: 30
int var5 = var3.read(); // L: 31
var3.seek(0L); // L: 32
var3.write(var5); // L: 33
var3.seek(0L); // L: 34
var3.close(); // L: 35
FileSystem.FileSystem_cacheFiles.put(var0, var2); // L: 36
return var2; // L: 37
}
} catch (Exception var8) {
try {
if (var3 != null) { // L: 41
var3.close(); // L: 42
var3 = null; // L: 43
}
} catch (Exception var7) { // L: 46
}
throw new RuntimeException(); // L: 48
}
}
}
}
}