Merge pull request #5394 from Abextm/if-cache-names
cache: Name InterfaceDefinition
This commit is contained in:
61
cache/src/main/java/net/runelite/cache/definitions/ClientScript1Instruction.java
vendored
Normal file
61
cache/src/main/java/net/runelite/cache/definitions/ClientScript1Instruction.java
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Abex
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.cache.definitions;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
public class ClientScript1Instruction
|
||||
{
|
||||
@RequiredArgsConstructor
|
||||
public enum Opcode
|
||||
{
|
||||
RETURN(0),
|
||||
BOOSTED_SKILL_LEVELS(1),
|
||||
REAL_SKILL_LEVELS(1),
|
||||
SKILL_EXPERIENCE(1),
|
||||
WIDGET_CONTAINS_ITEM_GET_QUANTITY(3),
|
||||
VARP(1),
|
||||
EXPERIENCE_AT_LEVEL_FOR_SKILL(1),
|
||||
VARP_TIMES_469(1),
|
||||
COMBAT_LEVEL(1),
|
||||
TOTAL_LEVEL(0),
|
||||
WIDGET_CONTAINS_ITEM_STAR(3),
|
||||
RUN_ENERGY(0),
|
||||
WEIGHT(0),
|
||||
VARP_TESTBIT(2),
|
||||
VARBIT(1),
|
||||
MINUS(0),
|
||||
DIV(0),
|
||||
MUL(0),
|
||||
WORLD_X(0),
|
||||
WORLD_Y(1),
|
||||
CONSTANT(1);
|
||||
|
||||
public final int argumentCount;
|
||||
}
|
||||
|
||||
public Opcode opcode;
|
||||
public int[] operands;
|
||||
}
|
||||
@@ -27,102 +27,102 @@ package net.runelite.cache.definitions;
|
||||
public class InterfaceDefinition
|
||||
{
|
||||
public int id = -1;
|
||||
public boolean hasScript = true;
|
||||
public boolean isIf3 = false;
|
||||
public int type;
|
||||
public int contentType;
|
||||
public int originalX;
|
||||
public int originalY;
|
||||
public int originalWidth;
|
||||
public int field2231;
|
||||
public int field2226;
|
||||
public int field2227;
|
||||
public int field2351;
|
||||
public int field2217;
|
||||
public int originalHeight;
|
||||
public int widthMode;
|
||||
public int heightMode;
|
||||
public int xPositionMode;
|
||||
public int yPositionMode;
|
||||
public int parentId = -1;
|
||||
public boolean isHidden;
|
||||
public int scrollWidth;
|
||||
public int scrollHeight;
|
||||
public boolean field2210;
|
||||
public boolean noClickThrough;
|
||||
public int spriteId;
|
||||
public int field2294;
|
||||
public boolean field2257;
|
||||
public int textureId;
|
||||
public boolean spriteTiling;
|
||||
public int opacity;
|
||||
public int borderThickness;
|
||||
public int sprite2;
|
||||
public int borderType;
|
||||
public int shadowColor;
|
||||
public boolean flippedVertically;
|
||||
public boolean flippedHorizontally;
|
||||
public int modelType;
|
||||
public int modelId;
|
||||
public int field2268;
|
||||
public int field2269;
|
||||
public int offsetX2d;
|
||||
public int offsetY2d;
|
||||
public int rotationX;
|
||||
public int rotationY;
|
||||
public int rotationZ;
|
||||
public int modelZoom;
|
||||
public int field2266;
|
||||
public boolean field2296;
|
||||
public int field2274;
|
||||
public int animation;
|
||||
public boolean orthogonal;
|
||||
public int modelHeightOverride;
|
||||
public int fontId;
|
||||
public String text;
|
||||
public int field2212;
|
||||
public int field2219;
|
||||
public int field2283;
|
||||
public int lineHeight;
|
||||
public int xTextAlignment;
|
||||
public int yTextAlignment;
|
||||
public boolean textShadowed;
|
||||
public int textColor;
|
||||
public boolean field2267;
|
||||
public int field2218;
|
||||
public boolean field2253;
|
||||
public int config;
|
||||
public boolean filled;
|
||||
public int lineWidth;
|
||||
public boolean lineDirection;
|
||||
public int clickMask;
|
||||
public String name;
|
||||
public String[] actions;
|
||||
public int field2295;
|
||||
public int field2223;
|
||||
public boolean field2297;
|
||||
public String selectedAction;
|
||||
public Object[] field2225;
|
||||
public Object[] field2300;
|
||||
public Object[] field2248;
|
||||
public Object[] field2311;
|
||||
public Object[] field2350;
|
||||
public Object[] field2312;
|
||||
public Object[] field2314;
|
||||
public Object[] field2316;
|
||||
public Object[] field2318;
|
||||
public Object[] field2319;
|
||||
public Object[] field2306;
|
||||
public Object[] field2337;
|
||||
public Object[] field2287;
|
||||
public Object[] field2303;
|
||||
public Object[] field2304;
|
||||
public Object[] field2308;
|
||||
public Object[] field2310;
|
||||
public Object[] field2262;
|
||||
public int[] field2313;
|
||||
public int[] field2315;
|
||||
public int[] field2282;
|
||||
public boolean field2299;
|
||||
public int dragDeadZone;
|
||||
public int dragDeadTime;
|
||||
public boolean dragRenderBehavior;
|
||||
public String targetVerb;
|
||||
public Object[] onLoadListener;
|
||||
public Object[] onMouseOverListener;
|
||||
public Object[] onMouseLeaveListener;
|
||||
public Object[] onTargetLeaveListener;
|
||||
public Object[] onTargetEnterListener;
|
||||
public Object[] onVarTransmitListener;
|
||||
public Object[] onInvTransmitListener;
|
||||
public Object[] onStatTransmitListener;
|
||||
public Object[] onTimerListener;
|
||||
public Object[] onOpListener;
|
||||
public Object[] onMouseRepeatListener;
|
||||
public Object[] onClickListener;
|
||||
public Object[] onClickRepeatListener;
|
||||
public Object[] onReleaseListener;
|
||||
public Object[] onHoldListener;
|
||||
public Object[] onDragListener;
|
||||
public Object[] onDragCompleteListener;
|
||||
public Object[] onScrollWheelListener;
|
||||
public int[] varTransmitTriggers;
|
||||
public int[] invTransmitTriggers;
|
||||
public int[] statTransmitTriggers;
|
||||
public boolean hasListener;
|
||||
|
||||
public int field2222;
|
||||
public int field2334;
|
||||
public int[] tableActions;
|
||||
public int[] field2333;
|
||||
public int[][] dynamicValues;
|
||||
public int menuType;
|
||||
// This is set to a siblings' child id when that widget should get a hover effect when this one is hovered
|
||||
public int hoveredSiblingId;
|
||||
public int[] alternateOperators;
|
||||
public int[] alternateRhs;
|
||||
public ClientScript1Instruction[][] clientScripts;
|
||||
public int[] itemIds;
|
||||
public int[] itemQuantities;
|
||||
public int paddingX;
|
||||
public int paddingY;
|
||||
public int[] xSprites;
|
||||
public int[] field2288;
|
||||
public int[] field2289;
|
||||
public int xPitch;
|
||||
public int yPitch;
|
||||
public int[] xOffsets;
|
||||
public int[] yOffsets;
|
||||
public int[] sprites;
|
||||
public String[] configActions;
|
||||
public String field2241;
|
||||
public int field2245;
|
||||
public int field2280;
|
||||
public int field2247;
|
||||
public int field2332;
|
||||
public int field2264;
|
||||
public int field2265;
|
||||
public int field2276;
|
||||
public String field2335;
|
||||
public String alternateText;
|
||||
public int alternateTextColor;
|
||||
public int hoveredTextColor;
|
||||
public int alternateHoveredTextColor;
|
||||
public int alternateSpriteId;
|
||||
public int alternateModelId;
|
||||
public int alternateAnimation;
|
||||
public String spellName;
|
||||
public String tooltip;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
*/
|
||||
package net.runelite.cache.definitions.loaders;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.runelite.cache.definitions.ClientScript1Instruction;
|
||||
import net.runelite.cache.definitions.InterfaceDefinition;
|
||||
import net.runelite.cache.io.InputStream;
|
||||
|
||||
@@ -35,54 +39,54 @@ public class InterfaceLoader
|
||||
iface.id = id;
|
||||
if (b[0] == -1)
|
||||
{
|
||||
method3252(iface, new InputStream(b));
|
||||
decodeIf3(iface, new InputStream(b));
|
||||
}
|
||||
else
|
||||
{
|
||||
method3251(iface, new InputStream(b));
|
||||
decodeIf1(iface, new InputStream(b));
|
||||
}
|
||||
|
||||
return iface;
|
||||
}
|
||||
|
||||
private void method3251(InterfaceDefinition iface, InputStream var1)
|
||||
private void decodeIf1(InterfaceDefinition iface, InputStream var1)
|
||||
{
|
||||
iface.hasScript = false;
|
||||
iface.isIf3 = false;
|
||||
iface.type = var1.readUnsignedByte();
|
||||
iface.field2222 = var1.readUnsignedByte();
|
||||
iface.menuType = var1.readUnsignedByte();
|
||||
iface.contentType = var1.readUnsignedShort();
|
||||
iface.originalX = var1.readShort();
|
||||
iface.originalY = var1.readShort();
|
||||
iface.originalWidth = var1.readUnsignedShort();
|
||||
iface.field2231 = var1.readUnsignedShort();
|
||||
iface.originalHeight = var1.readUnsignedShort();
|
||||
iface.opacity = var1.readUnsignedByte();
|
||||
iface.parentId = var1.readUnsignedShort();
|
||||
if (iface.parentId == '\uffff')
|
||||
if (iface.parentId == 0xFFFF)
|
||||
{
|
||||
iface.parentId = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
iface.parentId += iface.id & -65536;
|
||||
iface.parentId += iface.id & ~0xFFFF;
|
||||
}
|
||||
|
||||
iface.field2334 = var1.readUnsignedShort();
|
||||
if (iface.field2334 == '\uffff')
|
||||
iface.hoveredSiblingId = var1.readUnsignedShort();
|
||||
if (iface.hoveredSiblingId == 0xFFFF)
|
||||
{
|
||||
iface.field2334 = -1;
|
||||
iface.hoveredSiblingId = -1;
|
||||
}
|
||||
|
||||
int var2 = var1.readUnsignedByte();
|
||||
int var3;
|
||||
if (var2 > 0)
|
||||
{
|
||||
iface.tableActions = new int[var2];
|
||||
iface.field2333 = new int[var2];
|
||||
iface.alternateOperators = new int[var2];
|
||||
iface.alternateRhs = new int[var2];
|
||||
|
||||
for (var3 = 0; var3 < var2; ++var3)
|
||||
{
|
||||
iface.tableActions[var3] = var1.readUnsignedByte();
|
||||
iface.field2333[var3] = var1.readUnsignedShort();
|
||||
iface.alternateOperators[var3] = var1.readUnsignedByte();
|
||||
iface.alternateRhs[var3] = var1.readUnsignedShort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,20 +96,35 @@ public class InterfaceLoader
|
||||
int var6;
|
||||
if (var3 > 0)
|
||||
{
|
||||
iface.dynamicValues = new int[var3][];
|
||||
iface.clientScripts = new ClientScript1Instruction[var3][];
|
||||
|
||||
for (var4 = 0; var4 < var3; ++var4)
|
||||
{
|
||||
var5 = var1.readUnsignedShort();
|
||||
iface.dynamicValues[var4] = new int[var5];
|
||||
int[] bytecode = new int[var5];
|
||||
|
||||
for (var6 = 0; var6 < var5; ++var6)
|
||||
{
|
||||
iface.dynamicValues[var4][var6] = var1.readUnsignedShort();
|
||||
if (iface.dynamicValues[var4][var6] == '\uffff')
|
||||
bytecode[var6] = var1.readUnsignedShort();
|
||||
if (bytecode[var6] == 0xFFFF)
|
||||
{
|
||||
iface.dynamicValues[var4][var6] = -1;
|
||||
bytecode[var6] = -1;
|
||||
}
|
||||
|
||||
List<ClientScript1Instruction> instructions = new ArrayList<>();
|
||||
for (int i = 0; i < bytecode.length;)
|
||||
{
|
||||
ClientScript1Instruction ins = new ClientScript1Instruction();
|
||||
|
||||
ins.opcode = ClientScript1Instruction.Opcode.values()[bytecode[i++]];
|
||||
|
||||
int ac = ins.opcode.argumentCount;
|
||||
ins.operands = Arrays.copyOfRange(bytecode, i, i + ac);
|
||||
|
||||
instructions.add(ins);
|
||||
i += ac;
|
||||
}
|
||||
iface.clientScripts[var4] = instructions.toArray(new ClientScript1Instruction[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,37 +143,37 @@ public class InterfaceLoader
|
||||
|
||||
if (iface.type == 2)
|
||||
{
|
||||
iface.itemIds = new int[iface.originalWidth * iface.field2231];
|
||||
iface.itemQuantities = new int[iface.field2231 * iface.originalWidth];
|
||||
iface.itemIds = new int[iface.originalWidth * iface.originalHeight];
|
||||
iface.itemQuantities = new int[iface.originalHeight * iface.originalWidth];
|
||||
var4 = var1.readUnsignedByte();
|
||||
if (var4 == 1)
|
||||
{
|
||||
iface.config |= 268435456;
|
||||
iface.clickMask |= 268435456;
|
||||
}
|
||||
|
||||
var5 = var1.readUnsignedByte();
|
||||
if (var5 == 1)
|
||||
{
|
||||
iface.config |= 1073741824;
|
||||
iface.clickMask |= 1073741824;
|
||||
}
|
||||
|
||||
var6 = var1.readUnsignedByte();
|
||||
if (var6 == 1)
|
||||
{
|
||||
iface.config |= Integer.MIN_VALUE;
|
||||
iface.clickMask |= Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
int var7 = var1.readUnsignedByte();
|
||||
if (var7 == 1)
|
||||
{
|
||||
iface.config |= 536870912;
|
||||
iface.clickMask |= 536870912;
|
||||
}
|
||||
|
||||
iface.paddingX = var1.readUnsignedByte();
|
||||
iface.paddingY = var1.readUnsignedByte();
|
||||
iface.xSprites = new int[20];
|
||||
iface.field2288 = new int[20];
|
||||
iface.field2289 = new int[20];
|
||||
iface.xPitch = var1.readUnsignedByte();
|
||||
iface.yPitch = var1.readUnsignedByte();
|
||||
iface.xOffsets = new int[20];
|
||||
iface.yOffsets = new int[20];
|
||||
iface.sprites = new int[20];
|
||||
|
||||
int var8;
|
||||
for (var8 = 0; var8 < 20; ++var8)
|
||||
@@ -162,13 +181,13 @@ public class InterfaceLoader
|
||||
int var9 = var1.readUnsignedByte();
|
||||
if (var9 == 1)
|
||||
{
|
||||
iface.xSprites[var8] = var1.readShort();
|
||||
iface.field2288[var8] = var1.readShort();
|
||||
iface.field2289[var8] = var1.readInt();
|
||||
iface.xOffsets[var8] = var1.readShort();
|
||||
iface.yOffsets[var8] = var1.readShort();
|
||||
iface.sprites[var8] = var1.readInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
iface.field2289[var8] = -1;
|
||||
iface.sprites[var8] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,23 +199,23 @@ public class InterfaceLoader
|
||||
if (var11.length() > 0)
|
||||
{
|
||||
iface.configActions[var8] = var11;
|
||||
iface.config |= 1 << var8 + 23;
|
||||
iface.clickMask |= 1 << var8 + 23;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == 3)
|
||||
{
|
||||
iface.field2267 = var1.readUnsignedByte() == 1;
|
||||
iface.filled = var1.readUnsignedByte() == 1;
|
||||
}
|
||||
|
||||
if (iface.type == 4 || iface.type == 1)
|
||||
{
|
||||
iface.field2219 = var1.readUnsignedByte();
|
||||
iface.field2283 = var1.readUnsignedByte();
|
||||
iface.field2212 = var1.readUnsignedByte();
|
||||
iface.xTextAlignment = var1.readUnsignedByte();
|
||||
iface.yTextAlignment = var1.readUnsignedByte();
|
||||
iface.lineHeight = var1.readUnsignedByte();
|
||||
iface.fontId = var1.readUnsignedShort();
|
||||
if (iface.fontId == '\uffff')
|
||||
if (iface.fontId == 0xFFFF)
|
||||
{
|
||||
iface.fontId = -1;
|
||||
}
|
||||
@@ -207,7 +226,7 @@ public class InterfaceLoader
|
||||
if (iface.type == 4)
|
||||
{
|
||||
iface.text = var1.readString();
|
||||
iface.field2241 = var1.readString();
|
||||
iface.alternateText = var1.readString();
|
||||
}
|
||||
|
||||
if (iface.type == 1 || iface.type == 3 || iface.type == 4)
|
||||
@@ -217,43 +236,42 @@ public class InterfaceLoader
|
||||
|
||||
if (iface.type == 3 || iface.type == 4)
|
||||
{
|
||||
iface.field2245 = var1.readInt();
|
||||
iface.field2280 = var1.readInt();
|
||||
iface.field2247 = var1.readInt();
|
||||
iface.alternateTextColor = var1.readInt();
|
||||
iface.hoveredTextColor = var1.readInt();
|
||||
iface.alternateHoveredTextColor = var1.readInt();
|
||||
}
|
||||
|
||||
if (iface.type == 5)
|
||||
{
|
||||
iface.spriteId = var1.readInt();
|
||||
iface.field2332 = var1.readInt();
|
||||
iface.alternateSpriteId = var1.readInt();
|
||||
}
|
||||
|
||||
if (iface.type == 6)
|
||||
{
|
||||
iface.modelType = 1;
|
||||
iface.modelId = var1.readUnsignedShort();
|
||||
if (iface.modelId == '\uffff')
|
||||
if (iface.modelId == 0xFFFF)
|
||||
{
|
||||
iface.modelId = -1;
|
||||
}
|
||||
|
||||
iface.field2264 = 1;
|
||||
iface.field2265 = var1.readUnsignedShort();
|
||||
if (iface.field2265 == '\uffff')
|
||||
iface.alternateModelId = var1.readUnsignedShort();
|
||||
if (iface.alternateModelId == 0xFFFF)
|
||||
{
|
||||
iface.field2265 = -1;
|
||||
iface.alternateModelId = -1;
|
||||
}
|
||||
|
||||
iface.field2266 = var1.readUnsignedShort();
|
||||
if (iface.field2266 == '\uffff')
|
||||
iface.animation = var1.readUnsignedShort();
|
||||
if (iface.animation == 0xFFFF)
|
||||
{
|
||||
iface.field2266 = -1;
|
||||
iface.animation = -1;
|
||||
}
|
||||
|
||||
iface.field2276 = var1.readUnsignedShort();
|
||||
if (iface.field2276 == '\uffff')
|
||||
iface.alternateAnimation = var1.readUnsignedShort();
|
||||
if (iface.alternateAnimation == 0xFFFF)
|
||||
{
|
||||
iface.field2276 = -1;
|
||||
iface.alternateAnimation = -1;
|
||||
}
|
||||
|
||||
iface.modelZoom = var1.readUnsignedShort();
|
||||
@@ -263,23 +281,23 @@ public class InterfaceLoader
|
||||
|
||||
if (iface.type == 7)
|
||||
{
|
||||
iface.itemIds = new int[iface.originalWidth * iface.field2231];
|
||||
iface.itemQuantities = new int[iface.originalWidth * iface.field2231];
|
||||
iface.field2219 = var1.readUnsignedByte();
|
||||
iface.itemIds = new int[iface.originalWidth * iface.originalHeight];
|
||||
iface.itemQuantities = new int[iface.originalWidth * iface.originalHeight];
|
||||
iface.xTextAlignment = var1.readUnsignedByte();
|
||||
iface.fontId = var1.readUnsignedShort();
|
||||
if (iface.fontId == '\uffff')
|
||||
if (iface.fontId == 0xFFFF)
|
||||
{
|
||||
iface.fontId = -1;
|
||||
}
|
||||
|
||||
iface.textShadowed = var1.readUnsignedByte() == 1;
|
||||
iface.textColor = var1.readInt();
|
||||
iface.paddingX = var1.readShort();
|
||||
iface.paddingY = var1.readShort();
|
||||
iface.xPitch = var1.readShort();
|
||||
iface.yPitch = var1.readShort();
|
||||
var4 = var1.readUnsignedByte();
|
||||
if (var4 == 1)
|
||||
{
|
||||
iface.config |= 1073741824;
|
||||
iface.clickMask |= 1073741824;
|
||||
}
|
||||
|
||||
iface.configActions = new String[5];
|
||||
@@ -290,7 +308,7 @@ public class InterfaceLoader
|
||||
if (var10.length() > 0)
|
||||
{
|
||||
iface.configActions[var5] = var10;
|
||||
iface.config |= 1 << var5 + 23;
|
||||
iface.clickMask |= 1 << var5 + 23;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,57 +318,57 @@ public class InterfaceLoader
|
||||
iface.text = var1.readString();
|
||||
}
|
||||
|
||||
if (iface.field2222 == 2 || iface.type == 2)
|
||||
if (iface.menuType == 2 || iface.type == 2)
|
||||
{
|
||||
iface.selectedAction = var1.readString();
|
||||
iface.field2335 = var1.readString();
|
||||
iface.targetVerb = var1.readString();
|
||||
iface.spellName = var1.readString();
|
||||
var4 = var1.readUnsignedShort() & 63;
|
||||
iface.config |= var4 << 11;
|
||||
iface.clickMask |= var4 << 11;
|
||||
}
|
||||
|
||||
if (iface.field2222 == 1 || iface.field2222 == 4 || iface.field2222 == 5 || iface.field2222 == 6)
|
||||
if (iface.menuType == 1 || iface.menuType == 4 || iface.menuType == 5 || iface.menuType == 6)
|
||||
{
|
||||
iface.tooltip = var1.readString();
|
||||
if (iface.tooltip.length() == 0)
|
||||
{
|
||||
if (iface.field2222 == 1)
|
||||
if (iface.menuType == 1)
|
||||
{
|
||||
iface.tooltip = "Ok";
|
||||
}
|
||||
|
||||
if (iface.field2222 == 4)
|
||||
if (iface.menuType == 4)
|
||||
{
|
||||
iface.tooltip = "Select";
|
||||
}
|
||||
|
||||
if (iface.field2222 == 5)
|
||||
if (iface.menuType == 5)
|
||||
{
|
||||
iface.tooltip = "Select";
|
||||
}
|
||||
|
||||
if (iface.field2222 == 6)
|
||||
if (iface.menuType == 6)
|
||||
{
|
||||
iface.tooltip = "Continue";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.field2222 == 1 || iface.field2222 == 4 || iface.field2222 == 5)
|
||||
if (iface.menuType == 1 || iface.menuType == 4 || iface.menuType == 5)
|
||||
{
|
||||
iface.config |= 4194304;
|
||||
iface.clickMask |= 4194304;
|
||||
}
|
||||
|
||||
if (iface.field2222 == 6)
|
||||
if (iface.menuType == 6)
|
||||
{
|
||||
iface.config |= 1;
|
||||
iface.clickMask |= 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void method3252(InterfaceDefinition iface, InputStream var1)
|
||||
private void decodeIf3(InterfaceDefinition iface, InputStream var1)
|
||||
{
|
||||
var1.readUnsignedByte();
|
||||
iface.hasScript = true;
|
||||
iface.isIf3 = true;
|
||||
iface.type = var1.readUnsignedByte();
|
||||
iface.contentType = var1.readUnsignedShort();
|
||||
iface.originalX = var1.readShort();
|
||||
@@ -358,25 +376,25 @@ public class InterfaceLoader
|
||||
iface.originalWidth = var1.readUnsignedShort();
|
||||
if (iface.type == 9)
|
||||
{
|
||||
iface.field2231 = var1.readShort();
|
||||
iface.originalHeight = var1.readShort();
|
||||
}
|
||||
else
|
||||
{
|
||||
iface.field2231 = var1.readUnsignedShort();
|
||||
iface.originalHeight = var1.readUnsignedShort();
|
||||
}
|
||||
|
||||
iface.field2226 = var1.readByte();
|
||||
iface.field2227 = var1.readByte();
|
||||
iface.field2351 = var1.readByte();
|
||||
iface.field2217 = var1.readByte();
|
||||
iface.widthMode = var1.readByte();
|
||||
iface.heightMode = var1.readByte();
|
||||
iface.xPositionMode = var1.readByte();
|
||||
iface.yPositionMode = var1.readByte();
|
||||
iface.parentId = var1.readUnsignedShort();
|
||||
if (iface.parentId == '\uffff')
|
||||
if (iface.parentId == 0xFFFF)
|
||||
{
|
||||
iface.parentId = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
iface.parentId += iface.id & -65536;
|
||||
iface.parentId += iface.id & ~0xFFFF;
|
||||
}
|
||||
|
||||
iface.isHidden = var1.readUnsignedByte() == 1;
|
||||
@@ -384,17 +402,17 @@ public class InterfaceLoader
|
||||
{
|
||||
iface.scrollWidth = var1.readUnsignedShort();
|
||||
iface.scrollHeight = var1.readUnsignedShort();
|
||||
iface.field2210 = var1.readUnsignedByte() == 1;
|
||||
iface.noClickThrough = var1.readUnsignedByte() == 1;
|
||||
}
|
||||
|
||||
if (iface.type == 5)
|
||||
{
|
||||
iface.spriteId = var1.readInt();
|
||||
iface.field2294 = var1.readUnsignedShort();
|
||||
iface.field2257 = var1.readUnsignedByte() == 1;
|
||||
iface.textureId = var1.readUnsignedShort();
|
||||
iface.spriteTiling = var1.readUnsignedByte() == 1;
|
||||
iface.opacity = var1.readUnsignedByte();
|
||||
iface.borderThickness = var1.readUnsignedByte();
|
||||
iface.sprite2 = var1.readInt();
|
||||
iface.borderType = var1.readUnsignedByte();
|
||||
iface.shadowColor = var1.readInt();
|
||||
iface.flippedVertically = var1.readUnsignedByte() == 1;
|
||||
iface.flippedHorizontally = var1.readUnsignedByte() == 1;
|
||||
}
|
||||
@@ -403,31 +421,31 @@ public class InterfaceLoader
|
||||
{
|
||||
iface.modelType = 1;
|
||||
iface.modelId = var1.readUnsignedShort();
|
||||
if (iface.modelId == '\uffff')
|
||||
if (iface.modelId == 0xFFFF)
|
||||
{
|
||||
iface.modelId = -1;
|
||||
}
|
||||
|
||||
iface.field2268 = var1.readShort();
|
||||
iface.field2269 = var1.readShort();
|
||||
iface.offsetX2d = var1.readShort();
|
||||
iface.offsetY2d = var1.readShort();
|
||||
iface.rotationX = var1.readUnsignedShort();
|
||||
iface.rotationZ = var1.readUnsignedShort();
|
||||
iface.rotationY = var1.readUnsignedShort();
|
||||
iface.modelZoom = var1.readUnsignedShort();
|
||||
iface.field2266 = var1.readUnsignedShort();
|
||||
if (iface.field2266 == '\uffff')
|
||||
iface.animation = var1.readUnsignedShort();
|
||||
if (iface.animation == 0xFFFF)
|
||||
{
|
||||
iface.field2266 = -1;
|
||||
iface.animation = -1;
|
||||
}
|
||||
|
||||
iface.field2296 = var1.readUnsignedByte() == 1;
|
||||
iface.orthogonal = var1.readUnsignedByte() == 1;
|
||||
var1.readUnsignedShort();
|
||||
if (iface.field2226 != 0)
|
||||
if (iface.widthMode != 0)
|
||||
{
|
||||
iface.field2274 = var1.readUnsignedShort();
|
||||
iface.modelHeightOverride = var1.readUnsignedShort();
|
||||
}
|
||||
|
||||
if (iface.field2227 != 0)
|
||||
if (iface.heightMode != 0)
|
||||
{
|
||||
var1.readUnsignedShort();
|
||||
}
|
||||
@@ -436,15 +454,15 @@ public class InterfaceLoader
|
||||
if (iface.type == 4)
|
||||
{
|
||||
iface.fontId = var1.readUnsignedShort();
|
||||
if (iface.fontId == '\uffff')
|
||||
if (iface.fontId == 0xFFFF)
|
||||
{
|
||||
iface.fontId = -1;
|
||||
}
|
||||
|
||||
iface.text = var1.readString();
|
||||
iface.field2212 = var1.readUnsignedByte();
|
||||
iface.field2219 = var1.readUnsignedByte();
|
||||
iface.field2283 = var1.readUnsignedByte();
|
||||
iface.lineHeight = var1.readUnsignedByte();
|
||||
iface.xTextAlignment = var1.readUnsignedByte();
|
||||
iface.yTextAlignment = var1.readUnsignedByte();
|
||||
iface.textShadowed = var1.readUnsignedByte() == 1;
|
||||
iface.textColor = var1.readInt();
|
||||
}
|
||||
@@ -452,18 +470,18 @@ public class InterfaceLoader
|
||||
if (iface.type == 3)
|
||||
{
|
||||
iface.textColor = var1.readInt();
|
||||
iface.field2267 = var1.readUnsignedByte() == 1;
|
||||
iface.filled = var1.readUnsignedByte() == 1;
|
||||
iface.opacity = var1.readUnsignedByte();
|
||||
}
|
||||
|
||||
if (iface.type == 9)
|
||||
{
|
||||
iface.field2218 = var1.readUnsignedByte();
|
||||
iface.lineWidth = var1.readUnsignedByte();
|
||||
iface.textColor = var1.readInt();
|
||||
iface.field2253 = var1.readUnsignedByte() == 1;
|
||||
iface.lineDirection = var1.readUnsignedByte() == 1;
|
||||
}
|
||||
|
||||
iface.config = var1.read24BitInt();
|
||||
iface.clickMask = var1.read24BitInt();
|
||||
iface.name = var1.readString();
|
||||
int var2 = var1.readUnsignedByte();
|
||||
if (var2 > 0)
|
||||
@@ -476,34 +494,34 @@ public class InterfaceLoader
|
||||
}
|
||||
}
|
||||
|
||||
iface.field2295 = var1.readUnsignedByte();
|
||||
iface.field2223 = var1.readUnsignedByte();
|
||||
iface.field2297 = var1.readUnsignedByte() == 1;
|
||||
iface.selectedAction = var1.readString();
|
||||
iface.field2225 = this.method3282(iface, var1);
|
||||
iface.field2300 = this.method3282(iface, var1);
|
||||
iface.field2248 = this.method3282(iface, var1);
|
||||
iface.field2311 = this.method3282(iface, var1);
|
||||
iface.field2350 = this.method3282(iface, var1);
|
||||
iface.field2312 = this.method3282(iface, var1);
|
||||
iface.field2314 = this.method3282(iface, var1);
|
||||
iface.field2316 = this.method3282(iface, var1);
|
||||
iface.field2318 = this.method3282(iface, var1);
|
||||
iface.field2319 = this.method3282(iface, var1);
|
||||
iface.field2306 = this.method3282(iface, var1);
|
||||
iface.field2337 = this.method3282(iface, var1);
|
||||
iface.field2287 = this.method3282(iface, var1);
|
||||
iface.field2303 = this.method3282(iface, var1);
|
||||
iface.field2304 = this.method3282(iface, var1);
|
||||
iface.field2308 = this.method3282(iface, var1);
|
||||
iface.field2310 = this.method3282(iface, var1);
|
||||
iface.field2262 = this.method3282(iface, var1);
|
||||
iface.field2313 = this.method3274(var1);
|
||||
iface.field2315 = this.method3274(var1);
|
||||
iface.field2282 = this.method3274(var1);
|
||||
iface.dragDeadZone = var1.readUnsignedByte();
|
||||
iface.dragDeadTime = var1.readUnsignedByte();
|
||||
iface.dragRenderBehavior = var1.readUnsignedByte() == 1;
|
||||
iface.targetVerb = var1.readString();
|
||||
iface.onLoadListener = this.decodeListener(iface, var1);
|
||||
iface.onMouseOverListener = this.decodeListener(iface, var1);
|
||||
iface.onMouseLeaveListener = this.decodeListener(iface, var1);
|
||||
iface.onTargetLeaveListener = this.decodeListener(iface, var1);
|
||||
iface.onTargetEnterListener = this.decodeListener(iface, var1);
|
||||
iface.onVarTransmitListener = this.decodeListener(iface, var1);
|
||||
iface.onInvTransmitListener = this.decodeListener(iface, var1);
|
||||
iface.onStatTransmitListener = this.decodeListener(iface, var1);
|
||||
iface.onTimerListener = this.decodeListener(iface, var1);
|
||||
iface.onOpListener = this.decodeListener(iface, var1);
|
||||
iface.onMouseRepeatListener = this.decodeListener(iface, var1);
|
||||
iface.onClickListener = this.decodeListener(iface, var1);
|
||||
iface.onClickRepeatListener = this.decodeListener(iface, var1);
|
||||
iface.onReleaseListener = this.decodeListener(iface, var1);
|
||||
iface.onHoldListener = this.decodeListener(iface, var1);
|
||||
iface.onDragListener = this.decodeListener(iface, var1);
|
||||
iface.onDragCompleteListener = this.decodeListener(iface, var1);
|
||||
iface.onScrollWheelListener = this.decodeListener(iface, var1);
|
||||
iface.varTransmitTriggers = this.decodeTriggers(var1);
|
||||
iface.invTransmitTriggers = this.decodeTriggers(var1);
|
||||
iface.statTransmitTriggers = this.decodeTriggers(var1);
|
||||
}
|
||||
|
||||
private Object[] method3282(InterfaceDefinition iface, InputStream var1)
|
||||
private Object[] decodeListener(InterfaceDefinition iface, InputStream var1)
|
||||
{
|
||||
int var2 = var1.readUnsignedByte();
|
||||
if (var2 == 0)
|
||||
@@ -527,12 +545,12 @@ public class InterfaceLoader
|
||||
}
|
||||
}
|
||||
|
||||
iface.field2299 = true;
|
||||
iface.hasListener = true;
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
private int[] method3274(InputStream var1)
|
||||
private int[] decodeTriggers(InputStream var1)
|
||||
{
|
||||
int var2 = var1.readUnsignedByte();
|
||||
if (var2 == 0)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.cache.definitions.savers;
|
||||
|
||||
import net.runelite.cache.definitions.ClientScript1Instruction;
|
||||
import net.runelite.cache.definitions.InterfaceDefinition;
|
||||
import net.runelite.cache.io.OutputStream;
|
||||
|
||||
@@ -31,56 +32,74 @@ public class InterfaceSaver
|
||||
{
|
||||
public byte[] save(InterfaceDefinition def)
|
||||
{
|
||||
if (def.hasScript)
|
||||
if (def.isIf3)
|
||||
{
|
||||
return saveScript(def);
|
||||
return saveIf3(def);
|
||||
}
|
||||
else
|
||||
{
|
||||
return saveNoScript(def);
|
||||
return saveIf1(def);
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] saveScript(InterfaceDefinition def)
|
||||
private byte[] saveIf3(InterfaceDefinition def)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
private byte[] saveNoScript(InterfaceDefinition def)
|
||||
private byte[] saveIf1(InterfaceDefinition def)
|
||||
{
|
||||
OutputStream out = new OutputStream();
|
||||
out.writeByte(def.type);
|
||||
out.writeByte(def.field2222);
|
||||
out.writeByte(def.menuType);
|
||||
out.writeShort(def.contentType);
|
||||
out.writeShort(def.originalX);
|
||||
out.writeShort(def.originalY);
|
||||
out.writeShort(def.originalWidth);
|
||||
out.writeShort(def.field2231);
|
||||
out.writeShort(def.originalHeight);
|
||||
out.writeByte(def.opacity);
|
||||
out.writeShort(def.parentId);
|
||||
out.writeShort(def.field2334);
|
||||
if (def.tableActions != null)
|
||||
out.writeShort(def.hoveredSiblingId);
|
||||
if (def.alternateOperators != null)
|
||||
{
|
||||
out.writeByte(def.tableActions.length);
|
||||
for (int i = 0; i < def.tableActions.length; ++i)
|
||||
out.writeByte(def.alternateOperators.length);
|
||||
for (int i = 0; i < def.alternateOperators.length; ++i)
|
||||
{
|
||||
out.writeByte(def.tableActions[i]);
|
||||
out.writeShort(def.field2333[i]);
|
||||
out.writeByte(def.alternateOperators[i]);
|
||||
out.writeShort(def.alternateRhs[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out.writeByte(0);
|
||||
}
|
||||
if (def.dynamicValues != null)
|
||||
if (def.clientScripts != null)
|
||||
{
|
||||
out.writeByte(def.dynamicValues.length);
|
||||
for (int i = 0; i < def.dynamicValues.length; ++i)
|
||||
out.writeByte(def.clientScripts.length);
|
||||
for (int i = 0; i < def.clientScripts.length; ++i)
|
||||
{
|
||||
out.writeShort(def.dynamicValues[i].length);
|
||||
for (int j = 0; j < def.dynamicValues[i].length; ++j)
|
||||
int len = 0;
|
||||
for (int j = 0; j < def.clientScripts[i].length; ++j)
|
||||
{
|
||||
out.writeShort(def.dynamicValues[i][j]);
|
||||
ClientScript1Instruction ins = def.clientScripts[i][j];
|
||||
len++;
|
||||
if (ins.operands != null)
|
||||
{
|
||||
len += ins.operands.length;
|
||||
}
|
||||
}
|
||||
out.writeShort(len);
|
||||
for (int j = 0; j < def.clientScripts[i].length; ++j)
|
||||
{
|
||||
ClientScript1Instruction ins = def.clientScripts[i][j];
|
||||
out.writeShort(ins.opcode.ordinal());
|
||||
if (ins.operands != null)
|
||||
{
|
||||
for (int op : ins.operands)
|
||||
{
|
||||
out.writeShort(op);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,20 +119,20 @@ public class InterfaceSaver
|
||||
}
|
||||
if (def.type == 2)
|
||||
{
|
||||
out.writeByte((def.config & 268435456) != 0 ? 1 : 0);
|
||||
out.writeByte((def.config & 1073741824) != 0 ? 1 : 0);
|
||||
out.writeByte((def.config & Integer.MIN_VALUE) != 0 ? 1 : 0);
|
||||
out.writeByte((def.config & 536870912) != 0 ? 1 : 0);
|
||||
out.writeByte(def.paddingX);
|
||||
out.writeByte(def.paddingY);
|
||||
out.writeByte((def.clickMask & 268435456) != 0 ? 1 : 0);
|
||||
out.writeByte((def.clickMask & 1073741824) != 0 ? 1 : 0);
|
||||
out.writeByte((def.clickMask & Integer.MIN_VALUE) != 0 ? 1 : 0);
|
||||
out.writeByte((def.clickMask & 536870912) != 0 ? 1 : 0);
|
||||
out.writeByte(def.xPitch);
|
||||
out.writeByte(def.yPitch);
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
if (def.field2289[i] != -1)
|
||||
if (def.sprites[i] != -1)
|
||||
{
|
||||
out.writeByte(1);
|
||||
out.writeShort(def.xSprites[i]);
|
||||
out.writeShort(def.field2288[i]);
|
||||
out.writeShort(def.field2289[i]);
|
||||
out.writeShort(def.xOffsets[i]);
|
||||
out.writeShort(def.yOffsets[i]);
|
||||
out.writeShort(def.sprites[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -134,20 +153,20 @@ public class InterfaceSaver
|
||||
}
|
||||
if (def.type == 3)
|
||||
{
|
||||
out.writeByte(def.field2267 ? 1 : 0);
|
||||
out.writeByte(def.filled ? 1 : 0);
|
||||
}
|
||||
if (def.type == 4 || def.type == 1)
|
||||
{
|
||||
out.writeByte(def.field2219);
|
||||
out.writeByte(def.field2283);
|
||||
out.writeByte(def.field2212);
|
||||
out.writeByte(def.xTextAlignment);
|
||||
out.writeByte(def.yTextAlignment);
|
||||
out.writeByte(def.lineHeight);
|
||||
out.writeShort(def.fontId);
|
||||
out.writeByte(def.textShadowed ? 1 : 0);
|
||||
}
|
||||
if (def.type == 4)
|
||||
{
|
||||
out.writeString(def.text);
|
||||
out.writeString(def.field2241);
|
||||
out.writeString(def.alternateText);
|
||||
}
|
||||
if (def.type == 1 || def.type == 3 || def.type == 4)
|
||||
{
|
||||
@@ -155,34 +174,34 @@ public class InterfaceSaver
|
||||
}
|
||||
if (def.type == 3 || def.type == 4)
|
||||
{
|
||||
out.writeInt(def.field2245);
|
||||
out.writeInt(def.field2280);
|
||||
out.writeInt(def.field2247);
|
||||
out.writeInt(def.alternateTextColor);
|
||||
out.writeInt(def.hoveredTextColor);
|
||||
out.writeInt(def.alternateHoveredTextColor);
|
||||
}
|
||||
if (def.type == 5)
|
||||
{
|
||||
out.writeInt(def.spriteId);
|
||||
out.writeInt(def.field2332);
|
||||
out.writeInt(def.alternateSpriteId);
|
||||
}
|
||||
if (def.type == 6)
|
||||
{
|
||||
out.writeShort(def.modelId);
|
||||
out.writeShort(def.field2265);
|
||||
out.writeShort(def.field2266);
|
||||
out.writeShort(def.field2276);
|
||||
out.writeShort(def.alternateModelId);
|
||||
out.writeShort(def.animation);
|
||||
out.writeShort(def.alternateAnimation);
|
||||
out.writeShort(def.modelZoom);
|
||||
out.writeShort(def.rotationX);
|
||||
out.writeShort(def.rotationZ);
|
||||
}
|
||||
if (def.type == 7)
|
||||
{
|
||||
out.writeByte(def.field2219);
|
||||
out.writeByte(def.xTextAlignment);
|
||||
out.writeShort(def.fontId);
|
||||
out.writeByte(def.textShadowed ? 1 : 0);
|
||||
out.writeInt(def.textColor);
|
||||
out.writeShort(def.paddingX);
|
||||
out.writeShort(def.paddingY);
|
||||
out.writeByte((def.config & 1073741824) != 0 ? 1 : 0);
|
||||
out.writeShort(def.xPitch);
|
||||
out.writeShort(def.yPitch);
|
||||
out.writeByte((def.clickMask & 1073741824) != 0 ? 1 : 0);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
out.writeString(def.configActions[i]);
|
||||
@@ -192,13 +211,13 @@ public class InterfaceSaver
|
||||
{
|
||||
out.writeString(def.text);
|
||||
}
|
||||
if (def.field2222 == 2 || def.type == 2)
|
||||
if (def.menuType == 2 || def.type == 2)
|
||||
{
|
||||
out.writeString(def.selectedAction);
|
||||
out.writeString(def.field2335);
|
||||
out.writeShort((def.config >>> 11) & 63);
|
||||
out.writeString(def.targetVerb);
|
||||
out.writeString(def.spellName);
|
||||
out.writeShort((def.clickMask >>> 11) & 63);
|
||||
}
|
||||
if (def.field2222 == 1 || def.field2222 == 4 || def.field2222 == 5 || def.field2222 == 6)
|
||||
if (def.menuType == 1 || def.menuType == 4 || def.menuType == 5 || def.menuType == 6)
|
||||
{
|
||||
out.writeString(def.tooltip);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.junit.Test;
|
||||
|
||||
public class InterfaceSaverTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testSave() throws Exception
|
||||
{
|
||||
@@ -51,10 +50,10 @@ public class InterfaceSaverTest
|
||||
|
||||
Storage storage = store.getStorage();
|
||||
Index index = store.getIndex(IndexType.INTERFACES);
|
||||
Archive archive = index.getArchive(149);
|
||||
Archive archive = index.getArchive(31);
|
||||
byte[] archiveData = storage.loadArchive(archive);
|
||||
ArchiveFiles files = archive.getFiles(archiveData);
|
||||
FSFile file = files.findFile(0);
|
||||
FSFile file = files.findFile(76);
|
||||
byte[] contents = file.getContents();
|
||||
|
||||
InterfaceDefinition def = new InterfaceLoader().load(0, contents);
|
||||
|
||||
Reference in New Issue
Block a user