Skip to content

Instantly share code, notes, and snippets.

@riftrsps
Created April 27, 2020 17:56
Show Gist options
  • Select an option

  • Save riftrsps/3a3da66881b3e8677492157c2e3b5085 to your computer and use it in GitHub Desktop.

Select an option

Save riftrsps/3a3da66881b3e8677492157c2e3b5085 to your computer and use it in GitHub Desktop.
Stream stream = new Stream(streamLoader.getDataForName("data"));
int i = -1;
int j = stream.readUnsignedWord();
interfaceCache = new Widget[65000];
Client.instance.login.drawLoadingText(598, Client.instance.loadingGameString());
while (stream.currentOffset < stream.buffer.length) {
int k = stream.readUnsignedWord();
if (k == 65535) {
i = stream.readUnsignedWord();
k = stream.readUnsignedWord();
}
Widget rsInterface = interfaceCache[k] = new Widget();
rsInterface.id = k;
rsInterface.parentId = i;
rsInterface.setType(stream.readUnsignedByte());
rsInterface.atActionType = stream.readUnsignedByte();
rsInterface.actionType = stream.readUnsignedWord();
rsInterface.width = stream.readUnsignedWord();
rsInterface.height = stream.readUnsignedWord();
rsInterface.opacity = (byte) stream.readUnsignedByte();
rsInterface.isMouseoverTriggered = stream.readUnsignedByte();
if (rsInterface.isMouseoverTriggered != 0) {
rsInterface.isMouseoverTriggered = (rsInterface.isMouseoverTriggered - 1 << 8)
+ stream.readUnsignedByte();
} else {
rsInterface.isMouseoverTriggered = -1;
}
int i1 = stream.readUnsignedByte();
if (i1 > 0) {
rsInterface.scriptCompareType = new int[i1];
rsInterface.scriptCompareValue = new int[i1];
for (int j1 = 0; j1 < i1; j1++) {
rsInterface.scriptCompareType[j1] = stream.readUnsignedByte();
rsInterface.scriptCompareValue[j1] = stream.readUnsignedWord();
}
}
int k1 = stream.readUnsignedByte();
if (k1 > 0) {
rsInterface.valueIndexArray = new int[k1][];
for (int l1 = 0; l1 < k1; l1++) {
int i3 = stream.readUnsignedWord();
rsInterface.valueIndexArray[l1] = new int[i3];
for (int l4 = 0; l4 < i3; l4++) {
rsInterface.valueIndexArray[l1][l4] = stream.readUnsignedWord();
}
}
}
if (rsInterface.getType() == 0) {
rsInterface.drawsTransparent = false;
rsInterface.scrollMax = stream.readUnsignedWord();
rsInterface.invisible = stream.readUnsignedByte() == 1;
int i2 = stream.readUnsignedWord();
rsInterface.children = new int[i2];
rsInterface.childX = new int[i2];
rsInterface.childY = new int[i2];
for (int j3 = 0; j3 < i2; j3++) {
rsInterface.children[j3] = stream.readUnsignedWord();
rsInterface.childX[j3] = stream.readSignedWord();
rsInterface.childY[j3] = stream.readSignedWord();
}
}
if (rsInterface.getType() == 1) {
stream.readUnsignedWord();
stream.readUnsignedByte();
}
if (rsInterface.getType() == 2) {
rsInterface.inv = new int[rsInterface.width * rsInterface.height];
rsInterface.invStackSizes = new int[rsInterface.width * rsInterface.height];
rsInterface.itemsAreDraggable = stream.readUnsignedByte() == 1;
rsInterface.isInventoryInterface = stream.readUnsignedByte() == 1;
rsInterface.usableItemInterface = stream.readUnsignedByte() == 1;
rsInterface.itemsAreSwappable = stream.readUnsignedByte() == 1;
rsInterface.invSpritePadX = stream.readUnsignedByte();
rsInterface.invSpritePadY = stream.readUnsignedByte();
rsInterface.spritesX = new int[20];
rsInterface.spritesY = new int[20];
rsInterface.sprites = new Sprite[20];
for (int j2 = 0; j2 < 20; j2++) {
int k3 = stream.readUnsignedByte();
if (k3 == 1) {
rsInterface.spritesX[j2] = stream.readSignedWord();
rsInterface.spritesY[j2] = stream.readSignedWord();
String s1 = stream.readString();
if (streamLoader_1 != null && s1.length() > 0) {
int i5 = s1.lastIndexOf(",");
rsInterface.sprites[j2] = method207(Integer.parseInt(s1.substring(i5 + 1)), streamLoader_1,
s1.substring(0, i5));
}
}
}
rsInterface.actions = new String[5];
for (int l3 = 0; l3 < 5; l3++) {
rsInterface.actions[l3] = stream.readString();
if (rsInterface.actions[l3].length() == 0) {
rsInterface.actions[l3] = null;
}
if (rsInterface.parentId == 3824) {
rsInterface.actions[4] = "Buy X";
}
if (rsInterface.parentId == 3822) {
rsInterface.actions[4] = "Sell X";
}
}
if (rsInterface.parentId == 1644) {
rsInterface.actions[2] = "Operate";
}
}
if (rsInterface.getType() == 3) {
rsInterface.isFilled = stream.readUnsignedByte() == 1;
}
if (rsInterface.getType() == 4 || rsInterface.getType() == 1) {
rsInterface.centerText = stream.readUnsignedByte() == 1;
int k2 = stream.readUnsignedByte();
if (textDrawingAreas != null) {
rsInterface.textDrawingAreas = textDrawingAreas[k2];
}
rsInterface.textShadow = stream.readUnsignedByte() == 1;
}
if (rsInterface.getType() == 4) {
rsInterface.message = stream.readString();
rsInterface.messageEnabled = stream.readString();
}
if (rsInterface.getType() == 1 || rsInterface.getType() == 3 || rsInterface.getType() == 4) {
rsInterface.textColour = stream.readDWord();
Client.instance.music.modifyMusicTextColour(rsInterface);
}
if (rsInterface.getType() == 3 || rsInterface.getType() == 4) {
rsInterface.colourEnabled = stream.readDWord();
rsInterface.hoverColorDisabled = stream.readDWord();
rsInterface.hoverColorEnabled = stream.readDWord();
Client.instance.music.addHoverToMusicInterface(rsInterface);
if (rsInterface.id == 15234) // Strange place on music tab.
{
rsInterface.colourEnabled = 65280;
}
}
if (rsInterface.getType() == 5) {
rsInterface.drawsTransparent = false;
String s = stream.readString();
if (streamLoader_1 != null && s.length() > 0) {
int i4 = s.lastIndexOf(",");
rsInterface.enabledSprite = method207(Integer.parseInt(s.substring(i4 + 1)), streamLoader_1,
s.substring(0, i4));
}
s = stream.readString();
if (streamLoader_1 != null && s.length() > 0) {
int j4 = s.lastIndexOf(",");
rsInterface.disabledSprite = method207(Integer.parseInt(s.substring(j4 + 1)), streamLoader_1,
s.substring(0, j4));
}
}
if (rsInterface.getType() == 6) {
int l = stream.readUnsignedByte();
if (l != 0) {
rsInterface.modelTypeDisabled = 1;
rsInterface.mediaID = (l - 1 << 8) + stream.readUnsignedByte();
}
l = stream.readUnsignedByte();
if (l != 0) {
rsInterface.modelTypeEnabled = 1;
rsInterface.modelEnabled = (l - 1 << 8) + stream.readUnsignedByte();
}
l = stream.readUnsignedByte();
if (l != 0) {
rsInterface.sequenceDisabled = (l - 1 << 8) + stream.readUnsignedByte();
} else {
rsInterface.sequenceDisabled = -1;
}
l = stream.readUnsignedByte();
if (l != 0) {
rsInterface.sequenceEnabled = (l - 1 << 8) + stream.readUnsignedByte();
} else {
rsInterface.sequenceEnabled = -1;
}
rsInterface.modelZoom = stream.readUnsignedWord();
rsInterface.modelRotationY = stream.readUnsignedWord();
rsInterface.modelRotationX = stream.readUnsignedWord();
}
if (rsInterface.getType() == 7) {
rsInterface.inv = new int[rsInterface.width * rsInterface.height];
rsInterface.invStackSizes = new int[rsInterface.width * rsInterface.height];
rsInterface.centerText = stream.readUnsignedByte() == 1;
int l2 = stream.readUnsignedByte();
if (textDrawingAreas != null) {
rsInterface.textDrawingAreas = textDrawingAreas[l2];
}
rsInterface.textShadow = stream.readUnsignedByte() == 1;
rsInterface.textColour = stream.readDWord();
rsInterface.invSpritePadX = stream.readSignedWord();
rsInterface.invSpritePadY = stream.readSignedWord();
rsInterface.isInventoryInterface = stream.readUnsignedByte() == 1;
rsInterface.actions = new String[5];
for (int k4 = 0; k4 < 5; k4++) {
rsInterface.actions[k4] = stream.readString();
if (rsInterface.actions[k4].length() == 0) {
rsInterface.actions[k4] = null;
}
}
}
if (rsInterface.atActionType == 2 || rsInterface.getType() == 2) {
rsInterface.selectedActionName = stream.readString();
rsInterface.spellName = stream.readString();
rsInterface.spellUsableOn = stream.readUnsignedWord();
String green = "@gre@" + rsInterface.spellName + "@whi@";
rsInterface.spellName = green;
}
if (rsInterface.getType() == 8) {
rsInterface.message = stream.readString();
/*
* Only thing it prints out To view your messages:\n1) Logout and return to the
* frontpage of this website.\n2) Choose 'Read your messages from Jagex'. To
* start or cancel a subscription:\n1) Logout and return to the frontpage of
* this website.\n2) Choose the relevant option from the 'membership'
* section.\n\nNote: If you are a credit card subscriber a top-up payment
* will\nautomatically be taken when 3 days credit remain.\n(unless you cancel
* your subscription, which can be done \nat any time.) To change your recovery
* questions:\n1) Logout and return to the frontpage of this website.\n2) Choose
* 'Set new recovery questions'.
*/
}
if (rsInterface.atActionType == 1 || rsInterface.atActionType == 4 || rsInterface.atActionType == 5
|| rsInterface.atActionType == 6) {
rsInterface.tooltip = stream.readString();
if (rsInterface.tooltip.length() == 0) {
if (rsInterface.atActionType == 1) {
rsInterface.tooltip = "Select";
}
if (rsInterface.atActionType == 4) {
rsInterface.tooltip = "Select";
}
if (rsInterface.atActionType == 5) {
rsInterface.tooltip = "Select";
}
if (rsInterface.atActionType == 6) {
rsInterface.tooltip = "Continue";
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment