* Rename some things to be more consistent everywhere * rs-client: refactoring * MenuAction -> MenuOpcode merge
308 lines
7.6 KiB
Java
308 lines
7.6 KiB
Java
import java.io.IOException;
|
|
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("cu")
|
|
@Implements("DynamicObject")
|
|
public class DynamicObject extends Entity {
|
|
@ObfuscatedName("x")
|
|
@Export("Tiles_hueMultiplier")
|
|
static int[] Tiles_hueMultiplier;
|
|
@ObfuscatedName("q")
|
|
@ObfuscatedGetter(
|
|
intValue = -982722193
|
|
)
|
|
@Export("id")
|
|
int id;
|
|
@ObfuscatedName("w")
|
|
@ObfuscatedGetter(
|
|
intValue = 1770938715
|
|
)
|
|
@Export("type")
|
|
int type;
|
|
@ObfuscatedName("e")
|
|
@ObfuscatedGetter(
|
|
intValue = 187564889
|
|
)
|
|
@Export("orientation")
|
|
int orientation;
|
|
@ObfuscatedName("p")
|
|
@ObfuscatedGetter(
|
|
intValue = 618802147
|
|
)
|
|
@Export("plane")
|
|
int plane;
|
|
@ObfuscatedName("k")
|
|
@ObfuscatedGetter(
|
|
intValue = 490427017
|
|
)
|
|
@Export("x")
|
|
int x;
|
|
@ObfuscatedName("l")
|
|
@ObfuscatedGetter(
|
|
intValue = 660251733
|
|
)
|
|
@Export("y")
|
|
int y;
|
|
@ObfuscatedName("b")
|
|
@ObfuscatedSignature(
|
|
signature = "Lis;"
|
|
)
|
|
@Export("sequenceDefinition")
|
|
SequenceDefinition sequenceDefinition;
|
|
@ObfuscatedName("i")
|
|
@ObfuscatedGetter(
|
|
intValue = -1570424885
|
|
)
|
|
@Export("frame")
|
|
int frame;
|
|
@ObfuscatedName("c")
|
|
@ObfuscatedGetter(
|
|
intValue = 1283893717
|
|
)
|
|
@Export("cycleStart")
|
|
int cycleStart;
|
|
|
|
@ObfuscatedSignature(
|
|
signature = "(IIIIIIIZLeo;)V"
|
|
)
|
|
DynamicObject(int var1, int var2, int var3, int var4, int var5, int var6, int var7, boolean var8, Entity var9) {
|
|
this.id = var1;
|
|
this.type = var2;
|
|
this.orientation = var3;
|
|
this.plane = var4;
|
|
this.x = var5;
|
|
this.y = var6;
|
|
if (var7 == -1) {
|
|
return;
|
|
}
|
|
this.sequenceDefinition = GrandExchangeEvent.SequenceDefinition_get(var7);
|
|
this.frame = 0;
|
|
this.cycleStart = Client.cycle - 1;
|
|
if (this.sequenceDefinition.field3529 == 0 && var9 != null && var9 instanceof DynamicObject) {
|
|
DynamicObject var10 = (DynamicObject)var9;
|
|
if (var10.sequenceDefinition == this.sequenceDefinition) {
|
|
this.frame = var10.frame;
|
|
this.cycleStart = var10.cycleStart;
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (var8 && this.sequenceDefinition.frameCount != -1) {
|
|
this.frame = (int)(Math.random() * (double)this.sequenceDefinition.frameIds.length);
|
|
this.cycleStart -= (int)(Math.random() * (double)this.sequenceDefinition.frameLengths[this.frame]);
|
|
}
|
|
|
|
}
|
|
|
|
@ObfuscatedName("c")
|
|
@ObfuscatedSignature(
|
|
signature = "(I)Ldm;",
|
|
garbageValue = "759381421"
|
|
)
|
|
@Export("getModel")
|
|
protected final Model getModel() {
|
|
if (this.sequenceDefinition != null) {
|
|
int var1 = Client.cycle - this.cycleStart;
|
|
if (var1 > 100 && this.sequenceDefinition.frameCount > 0) {
|
|
var1 = 100;
|
|
}
|
|
|
|
label56: {
|
|
do {
|
|
do {
|
|
if (var1 <= this.sequenceDefinition.frameLengths[this.frame]) {
|
|
break label56;
|
|
}
|
|
|
|
var1 -= this.sequenceDefinition.frameLengths[this.frame];
|
|
++this.frame;
|
|
} while(this.frame < this.sequenceDefinition.frameIds.length);
|
|
|
|
this.frame -= this.sequenceDefinition.frameCount;
|
|
} while(this.frame >= 0 && this.frame < this.sequenceDefinition.frameIds.length);
|
|
|
|
this.sequenceDefinition = null;
|
|
}
|
|
|
|
this.cycleStart = Client.cycle - var1;
|
|
}
|
|
|
|
ObjectDefinition var12 = ViewportMouse.getObjectDefinition(this.id);
|
|
if (var12.transforms != null) {
|
|
var12 = var12.transform();
|
|
}
|
|
|
|
if (var12 == null) {
|
|
return null;
|
|
}
|
|
int var2;
|
|
int var3;
|
|
if (this.orientation != 1 && this.orientation != 3) {
|
|
var2 = var12.sizeX;
|
|
var3 = var12.sizeY;
|
|
} else {
|
|
var2 = var12.sizeY;
|
|
var3 = var12.sizeX;
|
|
}
|
|
|
|
int var4 = (var2 >> 1) + this.x;
|
|
int var5 = (var2 + 1 >> 1) + this.x;
|
|
int var6 = (var3 >> 1) + this.y;
|
|
int var7 = (var3 + 1 >> 1) + this.y;
|
|
int[][] var8 = Tiles.Tiles_heights[this.plane];
|
|
int var9 = var8[var4][var6] + var8[var5][var6] + var8[var4][var7] + var8[var5][var7] >> 2;
|
|
int var10 = (this.x << 7) + (var2 << 6);
|
|
int var11 = (this.y << 7) + (var3 << 6);
|
|
return var12.getModelDynamic(this.type, this.orientation, var8, var10, var9, var11, this.sequenceDefinition, this.frame);
|
|
}
|
|
|
|
@ObfuscatedName("w")
|
|
@ObfuscatedSignature(
|
|
signature = "(Lky;ZS)V",
|
|
garbageValue = "-31468"
|
|
)
|
|
@Export("NetCache_connect")
|
|
public static void NetCache_connect(AbstractSocket var0, boolean var1) {
|
|
if (NetCache.NetCache_socket != null) {
|
|
try {
|
|
NetCache.NetCache_socket.close();
|
|
} catch (Exception var8) {
|
|
}
|
|
|
|
NetCache.NetCache_socket = null;
|
|
}
|
|
|
|
NetCache.NetCache_socket = var0;
|
|
Buffer var2;
|
|
if (NetCache.NetCache_socket != null) {
|
|
try {
|
|
var2 = new Buffer(4);
|
|
var2.writeByte(var1 ? 2 : 3);
|
|
var2.writeMedium(0);
|
|
NetCache.NetCache_socket.write(var2.array, 0, 4);
|
|
} catch (IOException var7) {
|
|
try {
|
|
NetCache.NetCache_socket.close();
|
|
} catch (Exception var6) {
|
|
}
|
|
|
|
++NetCache.NetCache_ioExceptions;
|
|
NetCache.NetCache_socket = null;
|
|
}
|
|
}
|
|
|
|
NetCache.NetCache_responseHeaderBuffer.offset = 0;
|
|
class226.NetCache_currentResponse = null;
|
|
VarpDefinition.NetCache_responseArchiveBuffer = null;
|
|
NetCache.field3175 = 0;
|
|
|
|
while (true) {
|
|
NetFileRequest var9 = (NetFileRequest) NetCache.NetCache_pendingPriorityResponses.first();
|
|
if (var9 == null) {
|
|
break;
|
|
}
|
|
NetCache.NetCache_pendingPriorityWrites.put(var9, var9.key);
|
|
++NetCache.NetCache_pendingPriorityWritesCount;
|
|
--NetCache.NetCache_pendingPriorityResponsesCount;
|
|
}
|
|
|
|
while (true) {
|
|
NetFileRequest var9 = (NetFileRequest) NetCache.NetCache_pendingResponses.first();
|
|
if (var9 == null) {
|
|
break;
|
|
}
|
|
NetCache.NetCache_pendingWritesQueue.addLast(var9);
|
|
NetCache.NetCache_pendingWrites.put(var9, var9.key);
|
|
++NetCache.NetCache_pendingWritesCount;
|
|
--NetCache.NetCache_pendingResponsesCount;
|
|
}
|
|
|
|
if (NetCache.field3181 != 0) {
|
|
try {
|
|
var2 = new Buffer(4);
|
|
var2.writeByte(4);
|
|
var2.writeByte(NetCache.field3181);
|
|
var2.writeShort(0);
|
|
NetCache.NetCache_socket.write(var2.array, 0, 4);
|
|
} catch (IOException var5) {
|
|
try {
|
|
NetCache.NetCache_socket.close();
|
|
} catch (Exception var4) {
|
|
}
|
|
|
|
++NetCache.NetCache_ioExceptions;
|
|
NetCache.NetCache_socket = null;
|
|
}
|
|
}
|
|
NetCache.NetCache_loadTime = 0;
|
|
NetCache.NetCache_timeMs = DirectByteArrayCopier.currentTimeMs();
|
|
}
|
|
|
|
@ObfuscatedName("l")
|
|
@ObfuscatedSignature(
|
|
signature = "(Lbw;Lbw;IZB)I",
|
|
garbageValue = "24"
|
|
)
|
|
@Export("compareWorlds")
|
|
static int compareWorlds(World var0, World var1, int var2, boolean var3) {
|
|
if (var2 == 1) {
|
|
int var4 = var0.population;
|
|
int var5 = var1.population;
|
|
if (!var3) {
|
|
if (var4 == -1) {
|
|
var4 = 2001;
|
|
}
|
|
|
|
if (var5 == -1) {
|
|
var5 = 2001;
|
|
}
|
|
}
|
|
|
|
return var4 - var5;
|
|
}
|
|
if (var2 == 2) {
|
|
return var0.location - var1.location;
|
|
}
|
|
if (var2 == 3) {
|
|
if (var0.activity.equals("-")) {
|
|
if (var1.activity.equals("-")) {
|
|
return 0;
|
|
}
|
|
return var3 ? -1 : 1;
|
|
}
|
|
if (var1.activity.equals("-")) {
|
|
return var3 ? 1 : -1;
|
|
}
|
|
return var0.activity.compareTo(var1.activity);
|
|
}
|
|
if (var2 == 4) {
|
|
return var0.method1698() ? (var1.method1698() ? 0 : 1) : (var1.method1698() ? -1 : 0);
|
|
}
|
|
if (var2 == 5) {
|
|
return var0.method1682() ? (var1.method1682() ? 0 : 1) : (var1.method1682() ? -1 : 0);
|
|
}
|
|
if (var2 == 6) {
|
|
return var0.isPvp() ? (var1.isPvp() ? 0 : 1) : (var1.isPvp() ? -1 : 0);
|
|
}
|
|
if (var2 == 7) {
|
|
return var0.isMembersOnly() ? (var1.isMembersOnly() ? 0 : 1) : (var1.isMembersOnly() ? -1 : 0);
|
|
}
|
|
return var0.id - var1.id;
|
|
}
|
|
|
|
@ObfuscatedName("b")
|
|
@ObfuscatedSignature(
|
|
signature = "(I)Lbw;",
|
|
garbageValue = "-1381660129"
|
|
)
|
|
@Export("worldListStart")
|
|
static World worldListStart() {
|
|
World.World_listCount = 0;
|
|
return Canvas.getNextWorldListWorld();
|
|
}
|
|
}
|