diff --git a/.gitignore b/.gitignore index 71333915..13b1daee 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,8 @@ *.iml .DS_Store 2006Scape Server/data/logs +*.class +*.project +2006Scape Client/bin/ +*.prefs +*.classpath diff --git a/2006Scape Client/src/main/java/ClientSettings.java b/2006Scape Client/src/main/java/ClientSettings.java index d594b3c7..13e1b682 100644 --- a/2006Scape Client/src/main/java/ClientSettings.java +++ b/2006Scape Client/src/main/java/ClientSettings.java @@ -23,7 +23,7 @@ public class ClientSettings { * on localhost (Assuming you're running Client and LocalGame respectively) * */ - public static String SERVER_IP = "127.0.0.1"; + public static String SERVER_IP = "www.2006Scape.org"; /** * The Npc Bits for the Server */ diff --git a/2006Scape Client/src/main/java/DrawingArea.java b/2006Scape Client/src/main/java/DrawingArea.java index b548954f..a4744a11 100644 --- a/2006Scape Client/src/main/java/DrawingArea.java +++ b/2006Scape Client/src/main/java/DrawingArea.java @@ -50,29 +50,29 @@ public class DrawingArea extends NodeSub { } - public static void method335(int i, int j, int k, int l, int i1, int k1) { - if (k1 < topX) { - k -= topX - k1; - k1 = topX; + public static void fillArea(int _color, int _y, int _width, int _height, int _opacity, int _x) { + if (_x < topX) { + _width -= topX - _x; + _x = topX; } - if (j < topY) { - l -= topY - j; - j = topY; + if (_y < topY) { + _height -= topY - _y; + _y = topY; } - if (k1 + k > bottomX) { - k = bottomX - k1; + if (_x + _width > bottomX) { + _width = bottomX - _x; } - if (j + l > bottomY) { - l = bottomY - j; + if (_y + _height > bottomY) { + _height = bottomY - _y; } - int l1 = 256 - i1; - int i2 = (i >> 16 & 0xff) * i1; - int j2 = (i >> 8 & 0xff) * i1; - int k2 = (i & 0xff) * i1; - int k3 = width - k; - int l3 = k1 + j * width; - for (int i4 = 0; i4 < l; i4++) { - for (int j4 = -k; j4 < 0; j4++) { + int l1 = 256 - _opacity; + int i2 = (_color >> 16 & 0xff) * _opacity; + int j2 = (_color >> 8 & 0xff) * _opacity; + int k2 = (_color & 0xff) * _opacity; + int k3 = width - _width; + int l3 = _x + _y * width; + for (int i4 = 0; i4 < _height; i4++) { + for (int j4 = -_width; j4 < 0; j4++) { int l2 = (pixels[l3] >> 16 & 0xff) * l1; int i3 = (pixels[l3] >> 8 & 0xff) * l1; int j3 = (pixels[l3] & 0xff) * l1; @@ -84,26 +84,26 @@ public class DrawingArea extends NodeSub { } } - public static void method336(int i, int j, int l, int i1, int k) { - if (k < topX) { - i1 -= topX - k; - k = topX; + public static void fillArea(int _height, int _y, int _color, int _width, int _x) { + if (_x < topX) { + _width -= topX - _x; + _x = topX; } - if (j < topY) { - i -= topY - j; - j = topY; + if (_y < topY) { + _height -= topY - _y; + _y = topY; } - if (k + i1 > bottomX) { - i1 = bottomX - k; + if (_x + _width > bottomX) { + _width = bottomX - _x; } - if (j + i > bottomY) { - i = bottomY - j; + if (_y + _height > bottomY) { + _height = bottomY - _y; } - int k1 = width - i1; - int l1 = k + j * width; - for (int i2 = -i; i2 < 0; i2++) { - for (int j2 = -i1; j2 < 0; j2++) { - pixels[l1++] = l; + int k1 = width - _width; + int l1 = _x + _y * width; + for (int i2 = -_height; i2 < 0; i2++) { + for (int j2 = -_width; j2 < 0; j2++) { + pixels[l1++] = _color; } l1 += k1; @@ -111,23 +111,23 @@ public class DrawingArea extends NodeSub { } - public static void fillPixels(int i1, int k, int l, int i, int j) { - method339(i1, l, j, i); - method339(i1 + k - 1, l, j, i); - method341(i1, l, k, i); - method341(i1, l, k, i + j - 1); + public static void fillPixels(int _y, int _height, int _color, int _x, int _width) { + drawHorizontalLine(_y, _color, _width, _x); + drawHorizontalLine(_y + _height - 1, _color, _width, _x); + drawVerticalLine(_y, _color, _height, _x); + drawVerticalLine(_y, _color, _height, _x + _width - 1); } - public static void method338(int i, int j, int k, int l, int i1, int j1) { - method340(l, i1, i, k, j1); - method340(l, i1, i + j - 1, k, j1); - if (j >= 3) { - method342(l, j1, k, i + 1, j - 2); - method342(l, j1 + i1 - 1, k, i + 1, j - 2); + public static void drawFrameRounded(int _y, int _height, int _opacity, int _color, int _width, int _x) { + drawHorizontalLine(_color, _width, _y, _opacity, _x); + drawHorizontalLine(_color, _width, _y + _height - 1, _opacity, _x); + if (_height >= 3) { + drawVerticalLine(_color, _x, _opacity, _y + 1, _height - 2); + drawVerticalLine(_color, _x + _width - 1, _opacity, _y + 1, _height - 2); } } - public static void method339(int i, int j, int k, int l) { + public static void drawHorizontalLine(int i, int j, int k, int l) { if (i < topY || i >= bottomY) { return; } @@ -145,23 +145,23 @@ public class DrawingArea extends NodeSub { } - private static void method340(int i, int j, int k, int l, int i1) { - if (k < topY || k >= bottomY) { + private static void drawHorizontalLine(int _color, int _width, int _y, int _opacity, int _x) { + if (_y < topY || _y >= bottomY) { return; } - if (i1 < topX) { - j -= topX - i1; - i1 = topX; + if (_x < topX) { + _width -= topX - _x; + _x = topX; } - if (i1 + j > bottomX) { - j = bottomX - i1; + if (_x + _width > bottomX) { + _width = bottomX - _x; } - int j1 = 256 - l; - int k1 = (i >> 16 & 0xff) * l; - int l1 = (i >> 8 & 0xff) * l; - int i2 = (i & 0xff) * l; - int i3 = i1 + k * width; - for (int j3 = 0; j3 < j; j3++) { + int j1 = 256 - _opacity; + int k1 = (_color >> 16 & 0xff) * _opacity; + int l1 = (_color >> 8 & 0xff) * _opacity; + int i2 = (_color & 0xff) * _opacity; + int i3 = _x + _y * width; + for (int j3 = 0; j3 < _width; j3++) { int j2 = (pixels[i3] >> 16 & 0xff) * j1; int k2 = (pixels[i3] >> 8 & 0xff) * j1; int l2 = (pixels[i3] & 0xff) * j1; @@ -171,25 +171,25 @@ public class DrawingArea extends NodeSub { } - public static void method341(int i, int j, int k, int l) { - if (l < topX || l >= bottomX) { + public static void drawVerticalLine(int _y, int _color, int _height, int _x) { + if (_x < topX || _x >= bottomX) { return; } - if (i < topY) { - k -= topY - i; - i = topY; + if (_y < topY) { + _height -= topY - _y; + _y = topY; } - if (i + k > bottomY) { - k = bottomY - i; + if (_y + _height > bottomY) { + _height = bottomY - _y; } - int j1 = l + i * width; - for (int k1 = 0; k1 < k; k1++) { - pixels[j1 + k1 * width] = j; + int j1 = _x + _y * width; + for (int k1 = 0; k1 < _height; k1++) { + pixels[j1 + k1 * width] = _color; } } - private static void method342(int i, int j, int k, int l, int i1) { + private static void drawVerticalLine(int i, int j, int k, int l, int i1) { if (j < topX || j >= bottomX) { return; } diff --git a/2006Scape Client/src/main/java/EntityDef.java b/2006Scape Client/src/main/java/EntityDef.java index a3ca927a..70e8bd83 100644 --- a/2006Scape Client/src/main/java/EntityDef.java +++ b/2006Scape Client/src/main/java/EntityDef.java @@ -25,7 +25,7 @@ public final class EntityDef { break; case 945: - entityDef.name = "2006Scape Guide"; + entityDef.name = ClientSettings.SERVER_NAME + " Guide"; break; } return entityDef; @@ -92,10 +92,12 @@ public final class EntityDef { } } + public static int totalNPCs; + public static void unpackConfig(StreamLoader streamLoader) { stream = new Stream(streamLoader.getDataForName("npc.dat")); Stream stream2 = new Stream(streamLoader.getDataForName("npc.idx")); - int totalNPCs = stream2.readUnsignedWord(); + totalNPCs = stream2.readUnsignedWord(); streamIndices = new int[totalNPCs]; int i = 2; for (int j = 0; j < totalNPCs; j++) { diff --git a/2006Scape Client/src/main/java/Game.java b/2006Scape Client/src/main/java/Game.java index c0f26f78..92c29a5f 100644 --- a/2006Scape Client/src/main/java/Game.java +++ b/2006Scape Client/src/main/java/Game.java @@ -7,6 +7,7 @@ import javax.swing.*; import java.applet.AppletContext; import java.awt.*; import java.awt.event.KeyEvent; +import java.awt.event.MouseWheelEvent; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.EOFException; @@ -18,6 +19,7 @@ import java.io.OutputStream; import java.net.InetAddress; import java.net.Socket; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Calendar; @@ -364,17 +366,17 @@ public class Game extends RSApplet { Texture.lineOffsets = chatAreaOffsets; chatBack.method361(0, 0); if (messagePromptRaised) { - chatTextDrawingArea.drawText(0, aString1121, 40, 239); - chatTextDrawingArea.drawText(128, promptInput + "*", 60, 239); + chatTextDrawingArea.textCenter(0, aString1121, 40, 239); + chatTextDrawingArea.textCenter(128, promptInput + "*", 60, 239); } else if (inputDialogState == 1) { - chatTextDrawingArea.drawText(0, "Enter amount:", 40, 239); - chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 60, 239); + chatTextDrawingArea.textCenter(0, "Enter amount:", 40, 239); + chatTextDrawingArea.textCenter(128, amountOrNameInput + "*", 60, 239); } else if (inputDialogState == 2) { - chatTextDrawingArea.drawText(0, "Enter name:", 40, 239); - chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 60, 239); + chatTextDrawingArea.textCenter(0, "Enter name:", 40, 239); + chatTextDrawingArea.textCenter(128, amountOrNameInput + "*", 60, 239); } else if (aString844 != null) { - chatTextDrawingArea.drawText(0, aString844, 40, 239); - chatTextDrawingArea.drawText(128, "Click to continue", 60, 239); + chatTextDrawingArea.textCenter(0, aString844, 40, 239); + chatTextDrawingArea.textCenter(128, "Click to continue", 60, 239); } else if (backDialogID != -1) { drawInterface(0, 0, RSInterface.interfaceCache[backDialogID], 0);//CHANGED THIS - andrew was 0, 0 } else if (dialogID != -1) { @@ -400,7 +402,7 @@ public class Game extends RSApplet { if (l == 0) { if (i1 > 0 && i1 < 110) { try { - textDrawingArea.method389(false, 4, 0, chatMessages[k], i1); + textDrawingArea.textLeftShadow(false, 4, 0, chatMessages[k], i1); } catch (Exception e) { } @@ -418,16 +420,16 @@ public class Game extends RSApplet { modIcons[1].method361(j1, i1 - 12); j1 += 14; } - textDrawingArea.method385(0, s1 + ":", i1, j1); + textDrawingArea.textLeft(0, s1 + ":", i1, j1); j1 += textDrawingArea.getTextWidth(s1) + 8; - textDrawingArea.method385(255, chatMessages[k], i1, j1); + textDrawingArea.textLeft(255, chatMessages[k], i1, j1); } j++; } if ((l == 3 || l == 7) && splitpublicChat == 0 && (l == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s1))) { if (i1 > 0 && i1 < 110) { int k1 = 4; - textDrawingArea.method385(0, "From", i1, k1); + textDrawingArea.textLeft(0, "From", i1, k1); k1 += textDrawingArea.getTextWidth("From "); if (byte0 == 1) { modIcons[0].method361(k1, i1 - 12); @@ -437,34 +439,34 @@ public class Game extends RSApplet { modIcons[1].method361(k1, i1 - 12); k1 += 14; } - textDrawingArea.method385(0, s1 + ":", i1, k1); + textDrawingArea.textLeft(0, s1 + ":", i1, k1); k1 += textDrawingArea.getTextWidth(s1) + 8; - textDrawingArea.method385(0x800000, chatMessages[k], i1, k1); + textDrawingArea.textLeft(0x800000, chatMessages[k], i1, k1); } j++; } if (l == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) { if (i1 > 0 && i1 < 110) { - textDrawingArea.method385(0x800080, s1 + " " + chatMessages[k], i1, 4); + textDrawingArea.textLeft(0x800080, s1 + " " + chatMessages[k], i1, 4); } j++; } if (l == 5 && splitpublicChat == 0 && privateChatMode < 2) { if (i1 > 0 && i1 < 110) { - textDrawingArea.method385(0x800000, chatMessages[k], i1, 4); + textDrawingArea.textLeft(0x800000, chatMessages[k], i1, 4); } j++; } if (l == 6 && splitpublicChat == 0 && privateChatMode < 2) { if (i1 > 0 && i1 < 110) { - textDrawingArea.method385(0, "To " + s1 + ":", i1, 4); - textDrawingArea.method385(0x800000, chatMessages[k], i1, 12 + textDrawingArea.getTextWidth("To " + s1)); + textDrawingArea.textLeft(0, "To " + s1 + ":", i1, 4); + textDrawingArea.textLeft(0x800000, chatMessages[k], i1, 12 + textDrawingArea.getTextWidth("To " + s1)); } j++; } if (l == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) { if (i1 > 0 && i1 < 110) { - textDrawingArea.method385(0x7e3200, s1 + " " + chatMessages[k], i1, 4); + textDrawingArea.textLeft(0x7e3200, s1 + " " + chatMessages[k], i1, 4); } j++; } @@ -476,16 +478,16 @@ public class Game extends RSApplet { if (anInt1211 < 78) { anInt1211 = 78; } - method30(77, anInt1211 - anInt1089 - 77, 0, 463, anInt1211); + drawScrollThumb(77, anInt1211 - anInt1089 - 77, 0, 463, anInt1211); String s; if (myPlayer != null && myPlayer.name != null) { s = myPlayer.name; } else { s = TextClass.fixName(myUsername); } - textDrawingArea.method385(0, s + ":", 90, 4); - textDrawingArea.method385(255, inputString + "*", 90, 6 + textDrawingArea.getTextWidth(s + ": ")); - DrawingArea.method339(77, 0, 479, 0); + textDrawingArea.textLeft(0, s + ":", 90, 4); + textDrawingArea.textLeft(255, inputString + "*", 90, 6 + textDrawingArea.getTextWidth(s + ": ")); + DrawingArea.drawHorizontalLine(77, 0, 479, 0); } if (menuOpen && menuScreenArea == 2) { drawMenu(); @@ -497,7 +499,6 @@ public class Game extends RSApplet { public void init() { try { - nodeID = 10; portOff = 0; setHighMem(); isMembers = true; @@ -945,13 +946,13 @@ public class Game extends RSApplet { worldController.method295(plane, i, j); return; } - int k = 0xfa0a1f01; + long k = Long.MIN_VALUE; Object obj = null; for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) { ItemDef itemDef = ItemDef.forID(item.ID); - int l = itemDef.value; + long l = itemDef.value; if (itemDef.stackable) { - l *= item.anInt1559 + 1; + l *= item.amount + 1; // notifyItemSpawn(item, i + baseX, j + baseY); } @@ -1216,7 +1217,7 @@ public class Game extends RSApplet { } } - if (class9_1.actions != null) { + if (class9_1.actions != null && !(RSInterface.interfaceCache[5383].disabledText.startsWith("Search") && class9_1.parentID == 5292)) { for (int j4 = 4; j4 >= 0; j4--) { if (class9_1.actions[j4] != null) { menuActionName[menuActionRow] = class9_1.actions[j4] + " @lre@" + itemDef.name; @@ -1261,24 +1262,24 @@ public class Game extends RSApplet { } } - public void method30(int j, int k, int l, int i1, int j1) { + public void drawScrollThumb(int j, int k, int l, int i1, int j1) { scrollBar1.method361(i1, l); scrollBar2.method361(i1, l + j - 16); - DrawingArea.method336(j - 32, l + 16, anInt1002, 16, i1); + DrawingArea.fillArea(j - 32, l + 16, anInt1002, 16, i1); int k1 = (j - 32) * j / j1; if (k1 < 8) { k1 = 8; } int l1 = (j - 32 - k1) * k / (j1 - j); - DrawingArea.method336(k1, l + 16 + l1, anInt1063, 16, i1); - DrawingArea.method341(l + 16 + l1, anInt902, k1, i1); - DrawingArea.method341(l + 16 + l1, anInt902, k1, i1 + 1); - DrawingArea.method339(l + 16 + l1, anInt902, 16, i1); - DrawingArea.method339(l + 17 + l1, anInt902, 16, i1); - DrawingArea.method341(l + 16 + l1, anInt927, k1, i1 + 15); - DrawingArea.method341(l + 17 + l1, anInt927, k1 - 1, i1 + 14); - DrawingArea.method339(l + 15 + l1 + k1, anInt927, 16, i1); - DrawingArea.method339(l + 14 + l1 + k1, anInt927, 15, i1 + 1); + DrawingArea.fillArea(k1, l + 16 + l1, anInt1063, 16, i1); + DrawingArea.drawVerticalLine(l + 16 + l1, anInt902, k1, i1); + DrawingArea.drawVerticalLine(l + 16 + l1, anInt902, k1, i1 + 1); + DrawingArea.drawHorizontalLine(l + 16 + l1, anInt902, 16, i1); + DrawingArea.drawHorizontalLine(l + 17 + l1, anInt902, 16, i1); + DrawingArea.drawVerticalLine(l + 16 + l1, anInt927, k1, i1 + 15); + DrawingArea.drawVerticalLine(l + 17 + l1, anInt927, k1 - 1, i1 + 14); + DrawingArea.drawHorizontalLine(l + 15 + l1 + k1, anInt927, 16, i1); + DrawingArea.drawHorizontalLine(l + 14 + l1 + k1, anInt927, 15, i1 + 1); } public void updateNPCs(Stream stream, int i) { @@ -1316,12 +1317,10 @@ public class Game extends RSApplet { inputTaken = true; stream.createFrame(95); stream.writeWordBigEndian(publicChatMode); - //stream.writeWordBigEndian(publicChatMode); stream.writeWordBigEndian(privateChatMode); stream.writeWordBigEndian(tradeMode); } if (super.saveClickX >= 135 && super.saveClickX <= 235 && super.saveClickY >= 467 && super.saveClickY <= 499) { - //publicChatMode = (publicChatMode + 1) % 3; privateChatMode = (privateChatMode + 1) % 3; aBoolean1233 = true; inputTaken = true; @@ -1469,6 +1468,43 @@ public class Game extends RSApplet { public void updateEntities() { try { + // Draw item info + for (int k5 = 0; k5 < 104; k5++) { + for (int l5 = 0; l5 < 104; l5++) { + NodeList class19 = groundArray[plane][k5][l5]; + if (class19 != null) { + int offset = 5; + for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) { + ItemDef itemDef = ItemDef.forID(item.ID); + long totalValue = Math.max(1, item.amount) * Math.max(1, itemDef.value); + totalValue = totalValue > 0 ? totalValue : Integer.MAX_VALUE; + calcEntityScreenPos(k5 * 128 + 64, 20, l5 * 128 + 64); + // only show ground items names if worth more than x (1k default) + if (totalValue >= customSettingMinItemValue) { + int color = Color.WHITE.hashCode(); + if (totalValue >= 1e5) { + color = Color.GREEN.hashCode(); + } else if (totalValue >= 1e4) { + color = Color.CYAN.hashCode(); + } else if (totalValue >= 1e3) { + color = Color.YELLOW.hashCode(); + } + String text = ""; + if (item.amount > 1) { + DecimalFormatSymbols separator = new DecimalFormatSymbols(); + separator.setGroupingSeparator(','); + DecimalFormat formatter = new DecimalFormat("#,###,###,###", separator); + text += formatter.format(item.amount) + " x "; + } + text += itemDef.name + " (" + intToShortLetter(totalValue) + " gp)"; + aTextDrawingArea_1270.textLeft(color, text, spriteDrawY - offset, spriteDrawX - (aTextDrawingArea_1270.getTextWidth(text) / 2)); + offset += 10; + } + } + } + } + } + // Entity stuff int anInt974 = 0; for (int j = -1; j < playerCount + npcCount; j++) { Object obj; @@ -1494,6 +1530,23 @@ public class Game extends RSApplet { if (j < playerCount) { int l = 30; Player player = (Player) obj; + if (player.combatLevel == 0) { + if (customSettingVisiblePlayerNames) { + // Show shops + npcScreenPos(((Entity) obj), ((Entity) obj).height + 15); + // ItemDef.getSprite(995, 1000, 0xffff00).drawSprite(spriteDrawX - 16, spriteDrawY - l); + aTextDrawingArea_1270.textCenter(0x00ffff, "[SHOP]", spriteDrawY - 5, spriteDrawX); + } + } else if (customSettingVisiblePlayerNames) { + // Show player names + npcScreenPos(((Entity) obj), ((Entity) obj).height + 15); + aTextDrawingArea_1270.textCenter(0xffffff, player.name, spriteDrawY - 5, spriteDrawX); + if (player.privelage >= 1) { + npcScreenPos(((Entity) obj), ((Entity) obj).height + 15); + int icon = Math.max(0, Math.min(1, player.privelage - 1)); + modIcons[icon].method361( spriteDrawX - player.name.length() * 3 - 16, spriteDrawY - 7); + } + } if (player.headIcon >= 0) { npcScreenPos(((Entity) obj), ((Entity) obj).height + 15); if (spriteDrawX > -1) { @@ -1528,6 +1581,7 @@ public class Game extends RSApplet { } } } + // Chat messages sent if (((Entity) obj).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player) obj).name))) { npcScreenPos(((Entity) obj), ((Entity) obj).height); if (spriteDrawX > -1 && anInt974 < anInt975) { @@ -1551,6 +1605,7 @@ public class Game extends RSApplet { } } } + // HP markers for player? if (((Entity) obj).loopCycleStatus > loopCycle) { try { npcScreenPos(((Entity) obj), ((Entity) obj).height + 15); @@ -1559,12 +1614,13 @@ public class Game extends RSApplet { if (i1 > 30) { i1 = 30; } - DrawingArea.method336(5, spriteDrawY - 3, 65280, i1, spriteDrawX - 15); - DrawingArea.method336(5, spriteDrawY - 3, 0xff0000, 30 - i1, spriteDrawX - 15 + i1); + DrawingArea.fillArea(5, spriteDrawY - 3, 0x00ff00, i1, spriteDrawX - 15); + DrawingArea.fillArea(5, spriteDrawY - 3, 0xff0000, 30 - i1, spriteDrawX - 15 + i1); } } catch (Exception e) { } } + // Hit markers for (int j1 = 0; j1 < 4; j1++) { if (((Entity) obj).hitsLoopCycle[j1] > loopCycle) { npcScreenPos(((Entity) obj), ((Entity) obj).height / 2); @@ -1581,12 +1637,13 @@ public class Game extends RSApplet { spriteDrawY -= 10; } hitMarks[((Entity) obj).hitMarkTypes[j1]].drawSprite(spriteDrawX - 12, spriteDrawY - 12); - aTextDrawingArea_1270.drawText(0, String.valueOf(((Entity) obj).hitArray[j1]), spriteDrawY + 4, spriteDrawX); - aTextDrawingArea_1270.drawText(0xffffff, String.valueOf(((Entity) obj).hitArray[j1]), spriteDrawY + 3, spriteDrawX - 1); + aTextDrawingArea_1270.textCenter(0, String.valueOf(((Entity) obj).hitArray[j1]), spriteDrawY + 4, spriteDrawX); + aTextDrawingArea_1270.textCenter(0xffffff, String.valueOf(((Entity) obj).hitArray[j1]), spriteDrawY + 3, spriteDrawX - 1); } } } } + // Hit markers for (int k = 0; k < anInt974; k++) { int k1 = anIntArray976[k]; int l1 = anIntArray977[k]; @@ -1615,7 +1672,7 @@ public class Game extends RSApplet { i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000; } if (anIntArray980[k] == 7) { - i3 = anInt1265 % 20 >= 10 ? 65535 : 255; + i3 = anInt1265 % 20 >= 10 ? 0x00ffff : 255; } if (anIntArray980[k] == 8) { i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056; @@ -1627,7 +1684,7 @@ public class Game extends RSApplet { } else if (j3 < 100) { i3 = 0xffff00 - 0x50000 * (j3 - 50); } else if (j3 < 150) { - i3 = 65280 + 5 * (j3 - 100); + i3 = 0x00ff00 + 5 * (j3 - 100); } } if (anIntArray980[k] == 10) { @@ -1645,14 +1702,14 @@ public class Game extends RSApplet { if (l3 < 50) { i3 = 0xffffff - 0x50005 * l3; } else if (l3 < 100) { - i3 = 65280 + 0x50005 * (l3 - 50); + i3 = 0x00ff00 + 0x50005 * (l3 - 50); } else if (l3 < 150) { i3 = 0xffffff - 0x50000 * (l3 - 100); } } if (anIntArray981[k] == 0) { - chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX); - chatTextDrawingArea.drawText(i3, s, spriteDrawY, spriteDrawX); + chatTextDrawingArea.textCenter(0, s, spriteDrawY + 1, spriteDrawX); + chatTextDrawingArea.textCenter(i3, s, spriteDrawY, spriteDrawX); } if (anIntArray981[k] == 1) { chatTextDrawingArea.method386(0, s, spriteDrawX, anInt1265, spriteDrawY + 1); @@ -1670,8 +1727,8 @@ public class Game extends RSApplet { int i4 = chatTextDrawingArea.method384(s); int k4 = (150 - anIntArray982[k]) * (i4 + 100) / 150; DrawingArea.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0); - chatTextDrawingArea.method385(0, s, spriteDrawY + 1, spriteDrawX + 50 - k4); - chatTextDrawingArea.method385(i3, s, spriteDrawY, spriteDrawX + 50 - k4); + chatTextDrawingArea.textLeft(0, s, spriteDrawY + 1, spriteDrawX + 50 - k4); + chatTextDrawingArea.textLeft(i3, s, spriteDrawY, spriteDrawX + 50 - k4); DrawingArea.defaultDrawingAreaSize(); } if (anIntArray981[k] == 5) { @@ -1683,13 +1740,13 @@ public class Game extends RSApplet { l4 = j4 - 125; } DrawingArea.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - chatTextDrawingArea.anInt1497 - 1); - chatTextDrawingArea.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX); - chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4, spriteDrawX); + chatTextDrawingArea.textCenter(0, s, spriteDrawY + 1 + l4, spriteDrawX); + chatTextDrawingArea.textCenter(i3, s, spriteDrawY + l4, spriteDrawX); DrawingArea.defaultDrawingAreaSize(); } } else { - chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX); - chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY, spriteDrawX); + chatTextDrawingArea.textCenter(0, s, spriteDrawY + 1, spriteDrawX); + chatTextDrawingArea.textCenter(0xffff00, s, spriteDrawY, spriteDrawX); } } } catch (Exception e) { @@ -1723,10 +1780,62 @@ public class Game extends RSApplet { } } + public void drawButton(boolean enabled, int x, int y, int width) { + StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40); + // All these sprites are 30x30 + Sprite buttonLeft = new Sprite(streamLoader_2, "miscgraphics", enabled ? 7 : 4); + Sprite buttonRight = new Sprite(streamLoader_2, "miscgraphics", enabled ? 8 : 6); + int curWidth = 30; + buttonLeft.drawSprite(x, y); + while ((curWidth + 26) < width) { + buttonRight.drawSprite(x + curWidth, y); + curWidth += 26; + } + buttonRight.drawSprite(x + width - 30, y); + } + + public void drawCheckbox(boolean enabled, int x, int y) { + StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40); + Sprite checkboxUnchecked = new Sprite(streamLoader_2, "miscgraphics", 10); + Sprite checkboxChecked = new Sprite(streamLoader_2, "miscgraphics", 11); + } + public void drawTabArea() { aRSImageProducer_1163.initDrawingArea(); Texture.lineOffsets = tabAreaOffsets; invBack.method361(0, 0); + if (invOverlayInterfaceID == -1) { + if (tabInterfaceIDs[tabID] != -1) { + if (tabID == 7) { + try { + int centerX = 95; + int currentY = 10; + int textMiddle = 22; + int textTop = 14; + int textBottom = 29; + + drawButton(customSettingVisiblePlayerNames, centerX - 73, currentY, 146); + // buttonLeftDisabled.drawSprite(centerX - 73, currentY); + aTextDrawingArea_1271.textCenterShadow(Color.YELLOW.hashCode(), centerX, "always visible", currentY + textTop, true); + aTextDrawingArea_1271.textCenterShadow(Color.YELLOW.hashCode(), centerX, "player names", currentY + textBottom, true); + + drawButton(true, centerX - 73, currentY += 40, 146); + aTextDrawingArea_1271.textCenterShadow(Color.YELLOW.hashCode(), centerX, "item drops visible", currentY + textTop, true); + aTextDrawingArea_1271.textCenterShadow(Color.WHITE.hashCode(), centerX, intToKOrMil(customSettingMinItemValue) + " gp", currentY + textBottom, true); + + drawButton(true, centerX - 73, currentY += 40, 146); + aTextDrawingArea_1271.textCenterShadow(Color.YELLOW.hashCode(), centerX, "draw distance", currentY + textTop, true); + aTextDrawingArea_1271.textCenterShadow(Color.WHITE.hashCode(), centerX, WorldController.drawDistance + " tiles", currentY + textBottom, true); + + drawButton(customSettingShowExperiencePerHour, centerX - 73, currentY += 40, 146); + aTextDrawingArea_1271.textCenterShadow(customSettingShowExperiencePerHour ? Color.YELLOW.hashCode() : Color.YELLOW.hashCode(), centerX, "show exp info", currentY + textMiddle, true); + + drawButton(showInfo, centerX - 73, currentY += 40, 146); + aTextDrawingArea_1271.textCenterShadow(showInfo ? Color.YELLOW.hashCode() : Color.YELLOW.hashCode(), centerX, "show debug info", currentY + textMiddle, true); + } catch (Exception e) { } + } + } + } if (invOverlayInterfaceID != -1) { drawInterface(0, 0, RSInterface.interfaceCache[invOverlayInterfaceID], 0); } else if (tabInterfaceIDs[tabID] != -1) { @@ -1926,36 +2035,55 @@ public class Game extends RSApplet { } public void drawMenu() { - int i = menuOffsetX; - int j = menuOffsetY; - int k = menuWidth; - int l = anInt952; - int i1 = 0x5d5447; - DrawingArea.method336(l, j, i1, k, i); - DrawingArea.method336(16, j + 1, 0, k - 2, i + 1); - DrawingArea.fillPixels(j + 18, l - 19, 0, i + 1, k - 2); - chatTextDrawingArea.method385(i1, "Choose Option", j + 14, i + 3); - int j1 = super.mouseX; - int k1 = super.mouseY; + int xPos = menuOffsetX; + int yPos = menuOffsetY; + int menuW = menuWidth; + int menuH = anInt952; + int fill = 0x5d5447; + + DrawingArea.fillArea(menuH, yPos, fill, menuW, xPos); + DrawingArea.fillArea(16, yPos + 1, 0, menuW - 2, xPos + 1); + DrawingArea.fillPixels(yPos + 18, menuH - 19, 0, xPos + 1, menuW - 2); + chatTextDrawingArea.textLeft(fill, "Choose Option", yPos + 14, xPos + 3); + + // //Border + // DrawingArea.drawFrameRounded(yPos + 2, menuH - 4, 250, 0x706a5e, menuW, xPos); + // DrawingArea.drawFrameRounded(yPos + 1, menuH - 2, 250, 0x706a5e, menuW - 2, xPos + 1); + // DrawingArea.drawFrameRounded(yPos, menuH, 250, 0x706a5e, menuW - 4, xPos + 2); + // //Border + // DrawingArea.drawFrameRounded(yPos + 1, menuH - 2, 250, 0x2d2822, menuW - 6, xPos + 3); + // DrawingArea.drawFrameRounded(yPos + 2, menuH - 4, 250, 0x2d2822, menuW - 4, xPos + 2); + // DrawingArea.drawFrameRounded(yPos + 3, menuH - 6, 250, 0x2d2822, menuW - 2, xPos + 1); + // //Border + // DrawingArea.drawFrameRounded(yPos + 19, menuH - 22, 250, 0x524a3d, menuW - 4, xPos + 2); + // DrawingArea.drawFrameRounded(yPos + 20, menuH - 22, 250, 0x524a3d, menuW - 6, xPos + 3); + // //Menu Fill + // DrawingArea.fillArea(fill, yPos + 20, menuW - 6, menuH - 23, 170, xPos + 3); + // //Menu Header + // DrawingArea.fillArea(0x2a251e, yPos + 2, menuW - 6, 17, 170, xPos + 3); + // chatTextDrawingArea.method385(0xc6b895, "Choose Option", yPos + 14, xPos + 3); + + int mX = super.mouseX; + int mY = super.mouseY; if (menuScreenArea == 0) { - j1 -= 4; - k1 -= 4; + mX -= 4; + mY -= 4; } if (menuScreenArea == 1) { - j1 -= 553; - k1 -= 205; + mX -= 553; + mY -= 205; } if (menuScreenArea == 2) { - j1 -= 17; - k1 -= 357; + mX -= 17; + mY -= 357; } - for (int l1 = 0; l1 < menuActionRow; l1++) { - int i2 = j + 31 + (menuActionRow - 1 - l1) * 15; - int j2 = 0xffffff; - if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3) { - j2 = 0xffff00; + for (int rowItem = 0; rowItem < menuActionRow; rowItem++) { + int yPosItem = yPos + 31 + (menuActionRow - 1 - rowItem) * 15; + int colorItem = 0xffffff; + if (mX > xPos && mX < xPos + menuW && mY > yPosItem - 13 && mY < yPosItem + 3) { + colorItem = 0xffff00; } - chatTextDrawingArea.method389(true, i + 3, j2, menuActionName[l1], i2); + chatTextDrawingArea.textLeftShadow(true, xPos + 3, colorItem, menuActionName[rowItem], yPosItem); } } @@ -2033,6 +2161,27 @@ public class Game extends RSApplet { } } + public static String intToShortLetter(long number) { + DecimalFormat nf = new DecimalFormat("0.0"); + double i = number; + if (i >= 1e9) { // 1B + return nf.format((i / 1e9)) + "B"; + } + if (i >= 1e7) { // 1K + return (int) (i / 1e6) + "M"; + } + if (i >= 1e6) { // 1M + return nf.format((i / 1e6)) + "M"; + } + if (i >= 1e4) { // 1K + return (int) (i / 1e3) + "K"; + } + if (i >= 1e3) { // 1K + return nf.format((i / 1e3)) + "K"; + } + return "" + number; + } + public void resetLogout() { try { if (socketStream != null) { @@ -2470,11 +2619,11 @@ public class Game extends RSApplet { } for (int l2 = 0; l2 < 64; l2++) { - anIntArray852[l2 + 64] = 65280 + 4 * l2; + anIntArray852[l2 + 64] = 0x00ff00 + 4 * l2; } for (int i3 = 0; i3 < 64; i3++) { - anIntArray852[i3 + 128] = 65535 + 0x40000 * i3; + anIntArray852[i3 + 128] = 0x00ffff + 0x40000 * i3; } for (int j3 = 0; j3 < 64; j3++) { @@ -2789,6 +2938,8 @@ public class Game extends RSApplet { public void method60(int i) { RSInterface class9 = RSInterface.interfaceCache[i]; + if (class9 == null || class9.children == null) + return; for (int element : class9.children) { if (element == -1) { break; @@ -3178,13 +3329,13 @@ public class Game extends RSApplet { char c = '\u0168'; char c1 = '\310'; byte byte1 = 20; - chatTextDrawingArea.drawText(0xffffff, "" + ClientSettings.SERVER_NAME + " is loading - please wait...", c1 / 2 - 26 - byte1, c / 2); + chatTextDrawingArea.textCenter(0xffffff, "" + ClientSettings.SERVER_NAME + " is loading - please wait...", c1 / 2 - 26 - byte1, c / 2); int j = c1 / 2 - 18 - byte1; DrawingArea.fillPixels(j, 34, 0x8c1111, c / 2 - 152, 304); DrawingArea.fillPixels(j + 1, 32, 0, c / 2 - 151, 302); - DrawingArea.method336(30, j + 2, 0x8c1111, i * 3, c / 2 - 150); - DrawingArea.method336(30, j + 2, 0, 300 - i * 3, c / 2 - 150 + i * 3); - chatTextDrawingArea.drawText(0xffffff, s, c1 / 2 + 5 - byte1, c / 2); + DrawingArea.fillArea(30, j + 2, 0x8c1111, i * 3, c / 2 - 150); + DrawingArea.fillArea(30, j + 2, 0, 300 - i * 3, c / 2 - 150 + i * 3); + chatTextDrawingArea.textCenter(0xffffff, s, c1 / 2 + 5 - byte1, c / 2); aRSImageProducer_1109.drawGraphics(171, super.graphics, 202); if (welcomeScreenRaised) { welcomeScreenRaised = false; @@ -3413,12 +3564,12 @@ public class Game extends RSApplet { int j = 151; if (s != null) j -= 7; - aTextDrawingArea_1271.drawText(0, s1, j, 257); - aTextDrawingArea_1271.drawText(0xffffff, s1, j - 1, 256); + aTextDrawingArea_1271.textCenter(0, s1, j, 257); + aTextDrawingArea_1271.textCenter(0xffffff, s1, j - 1, 256); j += 15; if (s != null) { - aTextDrawingArea_1271.drawText(0, s, j, 257); - aTextDrawingArea_1271.drawText(0xffffff, s, j - 1, 256); + aTextDrawingArea_1271.textCenter(0, s, j, 257); + aTextDrawingArea_1271.textCenter(0xffffff, s, j - 1, 256); } aRSImageProducer_1165.drawGraphics(4, super.graphics, 4); return; @@ -3429,16 +3580,16 @@ public class Game extends RSApplet { int k = 251; char c = '\u012C'; byte byte0 = 50; - DrawingArea.method336(byte0, k - 5 - byte0 / 2, 0, c, 383 - c / 2); + DrawingArea.fillArea(byte0, k - 5 - byte0 / 2, 0, c, 383 - c / 2); DrawingArea.fillPixels(k - 5 - byte0 / 2, byte0, 0xffffff, 383 - c / 2, c); if (s != null) k -= 7; - aTextDrawingArea_1271.drawText(0, s1, k, 383); - aTextDrawingArea_1271.drawText(0xffffff, s1, k - 1, 382); + aTextDrawingArea_1271.textCenter(0, s1, k, 383); + aTextDrawingArea_1271.textCenter(0xffffff, s1, k - 1, 382); k += 15; if (s != null) { - aTextDrawingArea_1271.drawText(0, s, k, 383); - aTextDrawingArea_1271.drawText(0xffffff, s, k - 1, 382); + aTextDrawingArea_1271.textCenter(0, s, k, 383); + aTextDrawingArea_1271.textCenter(0xffffff, s, k - 1, 382); } super.fullGameScreen.drawGraphics(0, super.graphics, 0); } @@ -3682,6 +3833,7 @@ public class Game extends RSApplet { String s1 = menuActionName[i]; int l1 = s1.indexOf("@whi@"); if (l1 != -1) { + // Accept trade/duel from player s1 = s1.substring(l1 + 5).trim(); String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1))); boolean flag9 = false; @@ -4204,18 +4356,17 @@ public class Game extends RSApplet { if (l == 1125) { ItemDef itemDef = ItemDef.forID(i1); RSInterface class9_4 = RSInterface.interfaceCache[k]; - String s5; - if (class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0) { + if (class9_4 != null && class9_4.invStackSizes[j] >= 1e5) { DecimalFormatSymbols separator = new DecimalFormatSymbols(); separator.setGroupingSeparator(','); DecimalFormat formatter = new DecimalFormat("#,###,###,###", separator); - s5 = formatter.format(class9_4.invStackSizes[j]) + " x " + itemDef.name; - } else if (itemDef.description != null) { - s5 = new String(itemDef.description); - } else { - s5 = "It's a " + itemDef.name + "."; + pushMessage(formatter.format(class9_4.invStackSizes[j]) + " x " + itemDef.name, 0, ""); + } + if (itemDef.description != null) { + pushMessage(new String(itemDef.description) + " (" + intToKOrMil(itemDef.value) + "gp ea)", 0, ""); + } else { + pushMessage("It's a " + itemDef.name + ".", 0, ""); } - pushMessage(s5, 0, ""); } if (l == 169) { stream.createFrame(185); @@ -4274,7 +4425,7 @@ public class Game extends RSApplet { ItemDef itemDef_1 = ItemDef.forID(i1); String s6; if (itemDef_1.description != null) { - s6 = new String(itemDef_1.description); + s6 = new String(itemDef_1.description) + " (" + intToKOrMil(itemDef_1.value) + "gp ea)"; } else { s6 = "It's a " + itemDef_1.name + "."; } @@ -4665,7 +4816,49 @@ public class Game extends RSApplet { if (j == -1) { break; } - if (openInterfaceID != -1 && openInterfaceID == reportAbuseInterfaceID) { + if (customTabAction == 1 || customTabAction == 2) { + if (j >= 48 && j <= 57 && promptInput.length() < 10 && !promptInput.toLowerCase().contains("k") && !promptInput.toLowerCase().contains("m") && !promptInput.toLowerCase().contains("b")) { + promptInput += (char) j; + inputTaken = true; + } + if ((!promptInput.toLowerCase().contains("k") && !promptInput.toLowerCase().contains("m") && !promptInput.toLowerCase().contains("b")) && (j == 107 || j == 109) || j == 98) { + promptInput += (char) j; + inputTaken = true; + } + if (j == 8 && promptInput.length() > 0) { + promptInput = promptInput.substring(0, promptInput.length() - 1); + inputTaken = true; + } + try { + if (j == 13 || j == 10) { + if (promptInput.length() > 0) { + if (promptInput.toLowerCase().contains("k")) { + promptInput = promptInput.replaceAll("k", "000"); + } else if (promptInput.toLowerCase().contains("m")) { + promptInput = promptInput.replaceAll("m", "000000"); + } else if (promptInput.toLowerCase().contains("b")) { + promptInput = promptInput.replaceAll("b", "000000000"); + } + if (customTabAction == 1) { + customSettingMinItemValue = Integer.parseInt(promptInput); + } + if (customTabAction == 2) { + WorldController.drawDistance = Math.max(10, Math.min(100, Integer.parseInt(promptInput))); + zoom = Math.min(zoom, WorldController.drawDistance / 3); + } + } + customTabAction = 0; + inputTaken = true; + messagePromptRaised = false; + drawTabArea(); + } + } catch (NumberFormatException nfe) { + customTabAction = 0; + inputTaken = true; + messagePromptRaised = false; + pushMessage("Please enter a lower amount.", 0, ""); + } + } else if (openInterfaceID != -1 && openInterfaceID == reportAbuseInterfaceID) { if (j == 8 && reportAbuseInput.length() > 0) { reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1); } @@ -4721,7 +4914,7 @@ public class Game extends RSApplet { } } } else if (inputDialogState == 1) { - if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) { + if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10 && !amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m") && !amountOrNameInput.toLowerCase().contains("b")) { amountOrNameInput += (char) j; inputTaken = true; } @@ -4734,28 +4927,28 @@ public class Game extends RSApplet { inputTaken = true; } try { - if (j == 13 || j == 10) { - if (amountOrNameInput.length() > 0) { - if (amountOrNameInput.toLowerCase().contains("k")) { - amountOrNameInput = amountOrNameInput.replaceAll("k", "000"); - } else if (amountOrNameInput.toLowerCase().contains("m")) { - amountOrNameInput = amountOrNameInput.replaceAll("m", "000000"); - } else if (amountOrNameInput.toLowerCase().contains("b")) { - amountOrNameInput = amountOrNameInput.replaceAll("b", "000000000"); + if (j == 13 || j == 10) { + if (amountOrNameInput.length() > 0) { + if (amountOrNameInput.toLowerCase().contains("k")) { + amountOrNameInput = amountOrNameInput.replaceAll("k", "000"); + } else if (amountOrNameInput.toLowerCase().contains("m")) { + amountOrNameInput = amountOrNameInput.replaceAll("m", "000000"); + } else if (amountOrNameInput.toLowerCase().contains("b")) { + amountOrNameInput = amountOrNameInput.replaceAll("b", "000000000"); + } + int amount = 0; + amount = Integer.parseInt(amountOrNameInput); + stream.createFrame(208); + stream.writeDWord(amount); } - int amount = 0; - amount = Integer.parseInt(amountOrNameInput); - stream.createFrame(208); - stream.writeDWord(amount); + inputDialogState = 0; + inputTaken = true; } + } catch (NumberFormatException nfe) { inputDialogState = 0; inputTaken = true; + pushMessage("Please enter a lower amount.", 0, ""); } - } catch (NumberFormatException nfe) { - inputDialogState = 0; - inputTaken = true; - pushMessage("Please enter a lower amount.", 0, ""); - } } else if (inputDialogState == 2) { if (j >= 32 && j <= 122 && amountOrNameInput.length() < 12) { amountOrNameInput += (char) j; @@ -4774,13 +4967,53 @@ public class Game extends RSApplet { inputTaken = true; } } else { + // typing characters if (j >= 32 && j <= 122 && inputString.length() < 80) { inputString += (char) j; inputTaken = true; + if (inputString.startsWith("::search")) { + String[] args = inputString.split(" "); + inputDialogState = 3; + int searchType = 1; + String searchString = ""; + if (args.length < 2) { + return; + } + try { + searchType = Integer.parseInt(args[1]); + if (args.length >= 3) { + searchString = inputString.substring(inputString.indexOf(args[1]) + args[1].length() + 1); + } + } catch (Exception e) { + searchType = 1; + searchString = inputString.substring(args[0].length() + 1); + } + definitionSearch(searchString, searchType); + } } + // deleting characters if (j == 8 && inputString.length() > 0) { inputString = inputString.substring(0, inputString.length() - 1); inputTaken = true; + if (inputString.startsWith("::search")) { + String[] args = inputString.split(" "); + inputDialogState = 3; + int searchType = 1; + String searchString = ""; + if (args.length < 2) { + return; + } + try { + searchType = Integer.parseInt(args[1]); + if (args.length >= 3) { + searchString = inputString.substring(inputString.indexOf(args[1]) + args[1].length() + 1); + } + } catch (Exception e) { + searchType = 1; + searchString = inputString.substring(args[0].length() + 1); + } + definitionSearch(searchString, searchType); + } } if ((j == 13 || j == 10) && inputString.length() > 0) { if (inputString.equals("::gfxtgl") || inputString.equals("::tglgfx") || inputString.equals("::togglerender") || inputString.equals("::togglegfx")) { @@ -4793,14 +5026,47 @@ public class Game extends RSApplet { if (inputString.equals("::lag")) { printDebug(); } + if (inputString.startsWith("::int")) { + String[] args = inputString.split(" "); + int interfaceID = 1; + try { + interfaceID = Integer.parseInt(args[1]); + } catch (Exception e) { + interfaceID = 1; + } + openInterface(interfaceID); + inputString = ""; + inputTaken = true; + return; + } + if (inputString.equals("::mg")) { + if (tabInterfaceIDs[6] == 12855) + openSideInterface(6, 1151); + else + openSideInterface(6, 12855); + inputString = ""; + inputTaken = true; + return; + } if (inputString.equals("::prefetchmusic")) { for (int j1 = 0; j1 < onDemandFetcher.getVersionCount(2); j1++) { onDemandFetcher.method563((byte) 1, 2, j1); } - } - if (inputString.equals("::fps")) { - fpsOn = !fpsOn; + if (inputString.startsWith("::dd")) { + String[] args = inputString.split(" "); + int distance = 25; + try { + distance = Math.max(10, Math.min(100, Integer.parseInt(args[1]))); + } catch (Exception e) { + distance = 25; + } + WorldController.drawDistance = distance; + if (zoom > (WorldController.drawDistance / 3)) + zoom = WorldController.drawDistance / 3; + inputString = ""; + inputTaken = true; + return; } if (inputString.equals("::dataon")) { showInfo = !showInfo; @@ -5038,12 +5304,12 @@ public class Game extends RSApplet { class9.atActionType = 0; return; } - if (friendsNodeIDs[j] == 0) { + if (friendsNodeIDs[j] - 9 <= 0) { class9.disabledText = "@red@Offline"; } else if (friendsNodeIDs[j] == nodeID) { - class9.disabledText = "@gre@World-1"; + class9.disabledText = "@gre@World-" + (friendsNodeIDs[j] - 9); } else { - class9.disabledText = "@red@Offline"; + class9.disabledText = "@yel@World-" + (friendsNodeIDs[j] - 9); } class9.atActionType = 1; return; @@ -5256,8 +5522,8 @@ public class Game extends RSApplet { if ((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) { int l = 329 - i * 13; int k1 = 4; - textDrawingArea.method385(0, "From", l, k1); - textDrawingArea.method385(65535, "From", l - 1, k1); + textDrawingArea.textLeft(0, "From", l, k1); + textDrawingArea.textLeft(0x00ffff, "From", l - 1, k1); k1 += textDrawingArea.getTextWidth("From "); if (byte1 == 1) { modIcons[0].method361(k1, l - 12); @@ -5267,24 +5533,24 @@ public class Game extends RSApplet { modIcons[1].method361(k1, l - 12); k1 += 14; } - textDrawingArea.method385(0, s + ": " + chatMessages[j], l, k1); - textDrawingArea.method385(65535, s + ": " + chatMessages[j], l - 1, k1); + textDrawingArea.textLeft(0, s + ": " + chatMessages[j], l, k1); + textDrawingArea.textLeft(0x00ffff, s + ": " + chatMessages[j], l - 1, k1); if (++i >= 5) { return; } } if (k == 5 && privateChatMode < 2) { int i1 = 329 - i * 13; - textDrawingArea.method385(0, chatMessages[j], i1, 4); - textDrawingArea.method385(65535, chatMessages[j], i1 - 1, 4); + textDrawingArea.textLeft(0, chatMessages[j], i1, 4); + textDrawingArea.textLeft(0x00ffff, chatMessages[j], i1 - 1, 4); if (++i >= 5) { return; } } if (k == 6 && privateChatMode < 2) { int j1 = 329 - i * 13; - textDrawingArea.method385(0, "To " + s + ": " + chatMessages[j], j1, 4); - textDrawingArea.method385(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4); + textDrawingArea.textLeft(0, "To " + s + ": " + chatMessages[j], j1, 4); + textDrawingArea.textLeft(0x00ffff, "To " + s + ": " + chatMessages[j], j1 - 1, 4); if (++i >= 5) { return; } @@ -5323,6 +5589,14 @@ public class Game extends RSApplet { } } + int customTabAction = 0; + boolean customSettingVisiblePlayerNames = true; + int customSettingMinItemValue = 1000; + boolean customSettingShowExperiencePerHour = false; + long customSettingShowExperiencePerHourStartExp = 0; + long customSettingShowExperiencePerHourStart = System.currentTimeMillis(); + int customSettingShowExperiencePerHourStartLevels = 0; + public void processTabClick() { if (super.clickMode3 == 1) { if (super.saveClickX >= 539 && super.saveClickX <= 573 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[0] != -1) { @@ -5360,11 +5634,12 @@ public class Game extends RSApplet { tabID = 6; tabAreaAltered = true; } - /*if (super.saveClickX >= 540 && super.saveClickX <= 574 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[7] != -1) { + if (super.saveClickX >= 540 && super.saveClickX <= 574 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[7] != -1) { + /* Unused tab bottom left */ needDrawTabArea = true; tabID = 7; tabAreaAltered = true; - }*/ + } if (super.saveClickX >= 572 && super.saveClickX <= 602 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[8] != -1) { needDrawTabArea = true; tabID = 8; @@ -5395,6 +5670,46 @@ public class Game extends RSApplet { tabID = 13; tabAreaAltered = true; } + if (invOverlayInterfaceID == -1) { + if (tabInterfaceIDs[tabID] != -1) { + // Handle our custom tab + if (tabID == 7 && super.saveClickX >= 575 && super.saveClickX <= 720 && super.saveClickY >= 210 && super.saveClickY <= 465) { + int startY = 217 + 3; + if (super.saveClickY >= startY && super.saveClickY <= (startY + 30)) { + customSettingVisiblePlayerNames = !customSettingVisiblePlayerNames; + } + startY += 40; + if (super.saveClickY >= startY && super.saveClickY <= (startY + 30)) { + inputTaken = true; + inputDialogState = 0; + messagePromptRaised = true; + promptInput = ""; + aString1121 = "Enter minimum item value"; + customTabAction = 1; + } + startY += 40; + if (super.saveClickY >= startY && super.saveClickY <= (startY + 30)) { + inputTaken = true; + inputDialogState = 0; + messagePromptRaised = true; + promptInput = ""; + aString1121 = "Enter new draw distance"; + customTabAction = 2; + } + startY += 40; + if (super.saveClickY >= startY && super.saveClickY <= (startY + 30)) { + customSettingShowExperiencePerHour= !customSettingShowExperiencePerHour; + customSettingShowExperiencePerHourStart = System.currentTimeMillis(); + customSettingShowExperiencePerHourStartExp = calculateTotalExp(); + customSettingShowExperiencePerHourStartLevels = calculateTotalLevels(); + } + startY += 40; + if (super.saveClickY >= startY && super.saveClickY <= (startY + 30)) { + showInfo= !showInfo; + } + } + } + } if (anInt1054 == tabID) { stream.createFrame(152); stream.writeWordBigEndian(tabID); @@ -5682,8 +5997,8 @@ public class Game extends RSApplet { inStream.currentOffset = 0; pktType = -1; anInt841 = -1; - anInt842 = -1; - anInt843 = -1; + prevPktType = -1; + prevPktType2 = -1; pktSize = 0; anInt1009 = 0; anInt1104 = 0; @@ -5729,9 +6044,7 @@ public class Game extends RSApplet { for (int k3 = 0; k3 < 104; k3++) { groundArray[l2][i3][k3] = null; } - } - } aClass19_1179 = new NodeList(); @@ -5841,8 +6154,8 @@ public class Game extends RSApplet { inStream.currentOffset = 0; pktType = -1; anInt841 = -1; - anInt842 = -1; - anInt843 = -1; + prevPktType = -1; + prevPktType2 = -1; pktSize = 0; anInt1009 = 0; anInt1104 = 0; @@ -6157,7 +6470,7 @@ public class Game extends RSApplet { int l = stream.readUnsignedByte(); if ((l & 0x10) != 0) { int i1 = stream.method434(); - if (i1 == 65535) { + if (i1 == 0x00ffff) { i1 = -1; } int i2 = stream.readUnsignedByte(); @@ -6199,13 +6512,13 @@ public class Game extends RSApplet { if (npc.anInt1523 > loopCycle) { npc.anInt1521 = -1; } - if (npc.anInt1520 == 65535) { + if (npc.anInt1520 == 0x00ffff) { npc.anInt1520 = -1; } } if ((l & 0x20) != 0) { npc.interactingEntity = stream.readUnsignedWord(); - if (npc.interactingEntity == 65535) { + if (npc.interactingEntity == 0x00ffff) { npc.interactingEntity = -1; } } @@ -6350,7 +6663,11 @@ public class Game extends RSApplet { } String s; if (player.skill == 0) { - s = player.name + combatDiffColor(myPlayer.combatLevel, player.combatLevel) + " (level-" + player.combatLevel + ")"; + if (player.combatLevel > 0) { + s = player.name + combatDiffColor(myPlayer.combatLevel, player.combatLevel) + " (level-" + player.combatLevel + ")"; + } else { + s = player.name + " @cya@(store)"; + } } else { s = player.name + " (skill-" + player.skill + ")"; } @@ -7119,7 +7436,7 @@ public class Game extends RSApplet { // } try { // if (super.gameFrame != null) { - return new URL("http://" + server + ":" + (80 + portOff)); + return new URL("http://" + server + ":" + (8080 + portOff)); // } } catch (Exception _ex) { } @@ -7654,6 +7971,9 @@ public class Game extends RSApplet { redStone1_4.method361(229, 0); } } + if (tabInterfaceIDs[7] != -1 && (anInt1054 != 7 || loopCycle % 20 < 10)) { + sideIcons[10].method361(47, 2); + } if (tabInterfaceIDs[8] != -1 && (anInt1054 != 8 || loopCycle % 20 < 10)) { sideIcons[7].method361(74, 2); } @@ -7681,40 +8001,40 @@ public class Game extends RSApplet { aBoolean1233 = false; aRSImageProducer_1123.initDrawingArea(); backBase1.method361(0, 0); - aTextDrawingArea_1271.method382(0xffffff, 55, "Public chat", 28, true); + aTextDrawingArea_1271.textCenterShadow(0xffffff, 55, "Public chat", 28, true); if (publicChatMode == 0) { - aTextDrawingArea_1271.method382(65280, 55, "On", 41, true); + aTextDrawingArea_1271.textCenterShadow(0x00ff00, 55, "On", 41, true); } if (publicChatMode == 1) { - aTextDrawingArea_1271.method382(0xffff00, 55, "Friends", 41, true); + aTextDrawingArea_1271.textCenterShadow(0xffff00, 55, "Friends", 41, true); } if (publicChatMode == 2) { - aTextDrawingArea_1271.method382(0xff0000, 55, "Off", 41, true); + aTextDrawingArea_1271.textCenterShadow(0xff0000, 55, "Off", 41, true); } if (publicChatMode == 3) { - aTextDrawingArea_1271.method382(65535, 55, "Hide", 41, true); + aTextDrawingArea_1271.textCenterShadow(0x00ffff, 55, "Hide", 41, true); } - aTextDrawingArea_1271.method382(0xffffff, 184, "Private chat", 28, true); + aTextDrawingArea_1271.textCenterShadow(0xffffff, 184, "Private chat", 28, true); if (privateChatMode == 0) { - aTextDrawingArea_1271.method382(65280, 184, "On", 41, true); + aTextDrawingArea_1271.textCenterShadow(0x00ff00, 184, "On", 41, true); } if (privateChatMode == 1) { - aTextDrawingArea_1271.method382(0xffff00, 184, "Friends", 41, true); + aTextDrawingArea_1271.textCenterShadow(0xffff00, 184, "Friends", 41, true); } if (privateChatMode == 2) { - aTextDrawingArea_1271.method382(0xff0000, 184, "Off", 41, true); + aTextDrawingArea_1271.textCenterShadow(0xff0000, 184, "Off", 41, true); } - aTextDrawingArea_1271.method382(0xffffff, 324, "Trade/compete", 28, true); + aTextDrawingArea_1271.textCenterShadow(0xffffff, 324, "Trade/compete", 28, true); if (tradeMode == 0) { - aTextDrawingArea_1271.method382(65280, 324, "On", 41, true); + aTextDrawingArea_1271.textCenterShadow(0x00ff00, 324, "On", 41, true); } if (tradeMode == 1) { - aTextDrawingArea_1271.method382(0xffff00, 324, "Friends", 41, true); + aTextDrawingArea_1271.textCenterShadow(0xffff00, 324, "Friends", 41, true); } if (tradeMode == 2) { - aTextDrawingArea_1271.method382(0xff0000, 324, "Off", 41, true); + aTextDrawingArea_1271.textCenterShadow(0xff0000, 324, "Off", 41, true); } - aTextDrawingArea_1271.method382(0xffffff, 458, "Report abuse", 33, true); + aTextDrawingArea_1271.textCenterShadow(0xffffff, 458, "Report abuse", 33, true); aRSImageProducer_1123.drawGraphics(453, super.graphics, 0); aRSImageProducer_1165.initDrawingArea(); Texture.lineOffsets = chatBoxAreaOffsets; @@ -7800,7 +8120,7 @@ public class Game extends RSApplet { } drawInterface(component.scrollPosition, k2, component, l2); if (component.scrollMax > component.height) { - method30(component.height, component.scrollPosition, l2, k2 + component.width, component.scrollMax); + drawScrollThumb(component.height, component.scrollPosition, l2, k2 + component.width, component.scrollMax); } } else if (component.type != 1) { if (component.type == 2) { @@ -7837,6 +8157,7 @@ public class Game extends RSApplet { k6 = 0; j7 = 0; } + // Draw item being moved class30_sub2_sub1_sub1_2.drawSprite1(k5 + k6, j6 + j7); if (j6 + j7 < DrawingArea.topY && class9.scrollPosition > 0) { int i10 = anInt945 * (DrawingArea.topY - j6 - j7) / 3; @@ -7861,20 +8182,24 @@ public class Game extends RSApplet { anInt1088 -= j10; } } else if (atInventoryInterfaceType != 0 && atInventoryIndex == i3 && atInventoryInterface == component.id) { + // Using item? wear/unequip etc class30_sub2_sub1_sub1_2.drawSprite1(k5, j6); } else { + // Draw item in inventory/equipment etc class30_sub2_sub1_sub1_2.drawSprite(k5, j6); } if (class30_sub2_sub1_sub1_2.trimWidth == 33 || component.invStackSizes[i3] != 1) { + // Draw item amounts int k10 = component.invStackSizes[i3]; - aTextDrawingArea_1270.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6); - aTextDrawingArea_1270.method385(0xffff00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6); + aTextDrawingArea_1270.textLeft(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6); // shadow + aTextDrawingArea_1270.textLeft(0xffff00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6); // top layer } } } } else if (component.sprites != null && i3 < 20) { Sprite class30_sub2_sub1_sub1_1 = component.sprites[i3]; if (class30_sub2_sub1_sub1_1 != null) { + // Empty slots in equipment class30_sub2_sub1_sub1_1.drawSprite(k5, j6); } } @@ -7888,28 +8213,28 @@ public class Game extends RSApplet { if (anInt1039 == component.id || anInt1048 == component.id || anInt1026 == component.id) { flag = true; } - int j3; + int color; if (interfaceIsSelected(component)) { - j3 = component.anInt219; + color = component.anInt219; if (flag && component.anInt239 != 0) { - j3 = component.anInt239; + color = component.anInt239; } } else { - j3 = component.textColor; + color = component.textColor; if (flag && component.anInt216 != 0) { - j3 = component.anInt216; + color = component.anInt216; } } if (component.aByte254 == 0) { if (component.aBoolean227) { - DrawingArea.method336(component.height, l2, j3, component.width, k2); + DrawingArea.fillArea(component.height, l2, 0x2a251e, component.width, k2); } else { - DrawingArea.fillPixels(l2, component.height, j3, k2, component.width); + DrawingArea.fillPixels(l2, component.height, color, k2, component.width); } } else if (component.aBoolean227) { - DrawingArea.method335(j3, l2, component.width, component.height, 256 - (component.aByte254 & 0xff), k2); + DrawingArea.fillArea(color, l2, component.width, component.height, 256 - (component.aByte254 & 0xff), k2); } else { - DrawingArea.method338(l2, component.height, 256 - (component.aByte254 & 0xff), j3, component.width, k2); + DrawingArea.drawFrameRounded(l2, component.height, 256 - (component.aByte254 & 0xff), color, component.width, k2); } } else if (component.type == 4) { TextDrawingArea textDrawingArea = component.textDrawingAreas; @@ -7993,9 +8318,9 @@ public class Game extends RSApplet { s = ""; } if (component.aBoolean223) { - textDrawingArea.method382(i4, k2 + component.width / 2, s1, l6, component.aBoolean268); + textDrawingArea.textCenterShadow(i4, k2 + component.width / 2, s1, l6, component.aBoolean268); } else { - textDrawingArea.method389(component.aBoolean268, k2, i4, s1, l6); + textDrawingArea.textLeftShadow(component.aBoolean268, k2, i4, s1, l6); } } @@ -8049,9 +8374,9 @@ public class Game extends RSApplet { int i9 = k2 + i6 * (115 + component.invSpritePadX); int k9 = l2 + j5 * (12 + component.invSpritePadY); if (component.aBoolean223) { - textDrawingArea_1.method382(component.textColor, i9 + component.width / 2, s2, k9, component.aBoolean268); + textDrawingArea_1.textCenterShadow(component.textColor, i9 + component.width / 2, s2, k9, component.aBoolean268); } else { - textDrawingArea_1.method389(component.aBoolean268, i9, component.textColor, s2, k9); + textDrawingArea_1.textLeftShadow(component.aBoolean268, i9, component.textColor, s2, k9); } } k4++; @@ -8131,14 +8456,14 @@ public class Game extends RSApplet { if (player.anInt1523 > loopCycle) { player.anInt1521 = -1; } - if (player.anInt1520 == 65535) { + if (player.anInt1520 == 0x00ffff) { player.anInt1520 = -1; } //processSound(player.anInt1520, 0, player, null); } if ((i & 8) != 0) { int l = stream.method434(); - if (l == 65535) { + if (l == 0x00ffff) { l = -1; } //processSound(l, 1, player, null); @@ -8224,7 +8549,7 @@ public class Game extends RSApplet { } if ((i & 1) != 0) { player.interactingEntity = stream.method434(); - if (player.interactingEntity == 65535) { + if (player.interactingEntity == 0x00ffff) { player.interactingEntity = -1; } } @@ -8445,49 +8770,50 @@ public class Game extends RSApplet { if (anInt1055 == 1) { multiOverlay.drawSprite(472, 296); } - int k = 20; - int i1 = 0xffff00; - int x = baseX + (myPlayer.x - 6 >> 7); - int y = baseY + (myPlayer.y - 6 >> 7); - if (fpsOn) { - char c = '\u01FB'; - if (super.fps < 15) { - i1 = 0xff0000; - } - aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k); - k += 15; - Runtime runtime = Runtime.getRuntime(); - int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L); - i1 = 0xffff00; - if (j1 > 0x2000000 && lowMem) { - i1 = 0xff0000; - } - aTextDrawingArea_1271.method380("Mem:" + j1 + "k", c, 0xffff00, k); - k += 15; - } - if (showInfo) { - if (super.fps < 15) - i1 = 0xff0000; - aTextDrawingArea_1271.method385(0xffff00, "Fps:" + super.fps, 285, 5); - Runtime runtime = Runtime.getRuntime(); - int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L); - i1 = 0xffff00; - if (j1 > 0x2000000 && lowMem) - i1 = 0xff0000; - k += 15; - aTextDrawingArea_1271.method385(0xffff00, "Mem:" + j1 + "k", 299, 5); - aTextDrawingArea_1271.method385(0xffff00, "Mouse X: " + super.mouseX + " , Mouse Y: " + super.mouseY, 314, 5); - aTextDrawingArea_1271.method385(0xffff00, "Coords: " + x + ", " + y, 329, 5); - } if (anInt1104 != 0) { - int j = anInt1104 / 50; - int l = j / 60; - j %= 60; - if (j < 10) { - aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":0" + j, 329, 4); - } else { - aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":" + j, 329, 4); + String message = ""; + int seconds = anInt1104 / 50; + int minutes = seconds / 60; + int hours = minutes / 60; + seconds %= 60; + minutes %= 60; + if (hours > 0) { + if (hours < 10) + message += "0"; + message += hours + ":"; } + if (minutes > 0) { + if (minutes < 10) + message += "0"; + message += minutes + ":"; + } + if (seconds < 10) + message += "0"; + message += seconds + ""; + + // Draw the menu + int debugItems = 1; + int debugWidth = chatTextDrawingArea.getTextWidth("System update in: 00:00") + 10; //140; + int debugHeight = 25 + (debugItems * 15); + int debugX = 511 - debugWidth; + int debugY = 334 - debugHeight; + int fill = 0x5d5447; + int fill2 = Color.BLACK.hashCode(); + int opacity = 140; + + DrawingArea.fillArea(fill, debugY, debugWidth, debugHeight, opacity, debugX); + DrawingArea.fillArea(fill2, debugY + 1, debugWidth - 2, 16, opacity, debugX + 1); + DrawingArea.fillPixels(debugY + 18, debugHeight - 19, fill2, debugX + 1, debugWidth - 2); + chatTextDrawingArea.textLeft(Color.WHITE.darker().hashCode(), "Notification", debugY += 14, debugX + 3); + + // Bump Y value + debugY += 3; + + // Draw items + chatTextDrawingArea.textLeftShadow(true, debugX + 4, Color.WHITE.hashCode(), "System update in:", debugY += 15); + chatTextDrawingArea.textRightShadow(true, debugX + debugWidth - 4, Color.YELLOW.hashCode(), message, debugY); + + // Not sure what this is for anInt849++; if (anInt849 > 75) { anInt849 = 0; @@ -8722,6 +9048,8 @@ public class Game extends RSApplet { public boolean method119(int i, int j) { boolean flag1 = false; RSInterface class9 = RSInterface.interfaceCache[j]; + if (class9 == null || class9.children == null) + return flag1; for (int element : class9.children) { if (element == -1) { break; @@ -8762,8 +9090,8 @@ public class Game extends RSApplet { public int method120() { int j = 3; if (yCameraCurve < 310) { - int k = xCameraPos >> 7; - int l = yCameraPos >> 7; + int k = Math.max(0, Math.min(103, xCameraPos >> 7)); + int l = Math.max(0, Math.min(103, yCameraPos >> 7)); int i1 = myPlayer.x >> 7; int j1 = myPlayer.y >> 7; if ((byteGroundArray[plane][k][l] & 4) != 0) { @@ -9053,6 +9381,7 @@ public class Game extends RSApplet { int l2 = 464 - myPlayer.y / 32; aClass30_Sub2_Sub1_Sub1_1263.method352(151, i, anIntArray1229, 256 + minimapInt3, anIntArray1052, l2, 5, 25, 146, j); compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968, 25, 0, 0, 33, 25); + // Minimap icons (shops, quest etc) for (int j5 = 0; j5 < anInt1071; j5++) { int k = anIntArray1072[j5] * 4 + 2 - myPlayer.x / 32; int i3 = anIntArray1073[j5] * 4 + 2 - myPlayer.y / 32; @@ -9068,7 +9397,6 @@ public class Game extends RSApplet { markMinimap(mapDotItem, l, j3); } } - } for (int i6 = 0; i6 < npcCount; i6++) { @@ -9092,23 +9420,25 @@ public class Game extends RSApplet { int j1 = player.x / 32 - myPlayer.x / 32; int l3 = player.y / 32 - myPlayer.y / 32; boolean flag1 = false; + boolean flag2 = false; long l6 = TextClass.longForName(player.name); + + if (myPlayer.team != 0 && player.team != 0 && myPlayer.team == player.team || player.combatLevel == 0) { + flag1 = true; + } + for (int k6 = 0; k6 < friendsCount; k6++) { if (l6 != friendsListAsLongs[k6] || friendsNodeIDs[k6] == 0) { continue; } - flag1 = true; + flag2 = true; break; } - boolean flag2 = false; - if (myPlayer.team != 0 && player.team != 0 && myPlayer.team == player.team) { - flag2 = true; - } if (flag1) { - markMinimap(mapDotFriend, j1, l3); - } else if (flag2) { markMinimap(mapDotTeam, j1, l3); + } else if (flag2) { + markMinimap(mapDotFriend, j1, l3); } else { markMinimap(mapDotPlayer, j1, l3); } @@ -9143,7 +9473,8 @@ public class Game extends RSApplet { int l4 = destY * 4 + 2 - myPlayer.y / 32; markMinimap(mapFlag, j2, l4); } - DrawingArea.method336(3, 78, 0xffffff, 3, 97); + // Draw player square on mini map + DrawingArea.fillArea(3, 78, 0xffffff, 3, 97); aRSImageProducer_1165.initDrawingArea(); Texture.lineOffsets = chatBoxAreaOffsets; } @@ -9457,57 +9788,57 @@ public class Game extends RSApplet { char c1 = '\310'; if (loginScreenState == 0) { int i = c1 / 2 + 80; - aTextDrawingArea_1270.method382(0x75a9a9, c / 2, onDemandFetcher.statusString, i, true); + aTextDrawingArea_1270.textCenterShadow(0x75a9a9, c / 2, onDemandFetcher.statusString, i, true); i = c1 / 2 - 20; - chatTextDrawingArea.method382(0xffff00, c / 2, "Welcome to " + ClientSettings.SERVER_NAME + "", i, true); + chatTextDrawingArea.textCenterShadow(0xffff00, c / 2, "Welcome to " + ClientSettings.SERVER_NAME + "", i, true); i += 30; int l = c / 2 - 80; int k1 = c1 / 2 + 20; aBackground_967.method361(l - 73, k1 - 20); - chatTextDrawingArea.method382(0xffffff, l, "New User", k1 + 5, true); + chatTextDrawingArea.textCenterShadow(0xffffff, l, "New User", k1 + 5, true); l = c / 2 + 80; aBackground_967.method361(l - 73, k1 - 20); - chatTextDrawingArea.method382(0xffffff, l, "Existing User", k1 + 5, true); + chatTextDrawingArea.textCenterShadow(0xffffff, l, "Existing User", k1 + 5, true); } if (loginScreenState == 2) { int j = c1 / 2 - 40; if (loginMessage1.length() > 0) { - chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage1, j - 15, true); - chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2, j, true); + chatTextDrawingArea.textCenterShadow(0xffff00, c / 2, loginMessage1, j - 15, true); + chatTextDrawingArea.textCenterShadow(0xffff00, c / 2, loginMessage2, j, true); j += 30; } else { - chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2, j - 7, true); + chatTextDrawingArea.textCenterShadow(0xffff00, c / 2, loginMessage2, j - 7, true); j += 30; } - chatTextDrawingArea.method389(true, c / 2 - 90, 0xffffff, "Username: " + myUsername + (loginScreenCursorPos == 0 & loopCycle % 40 < 20 ? "@yel@|" : ""), j); + chatTextDrawingArea.textLeftShadow(true, c / 2 - 90, 0xffffff, "Username: " + myUsername + (loginScreenCursorPos == 0 & loopCycle % 40 < 20 ? "@yel@|" : ""), j); j += 15; - chatTextDrawingArea.method389(true, c / 2 - 88, 0xffffff, "Password: " + TextClass.passwordAsterisks(myPassword) + (loginScreenCursorPos == 1 & loopCycle % 40 < 20 ? "@yel@|" : ""), j); + chatTextDrawingArea.textLeftShadow(true, c / 2 - 88, 0xffffff, "Password: " + TextClass.passwordAsterisks(myPassword) + (loginScreenCursorPos == 1 & loopCycle % 40 < 20 ? "@yel@|" : ""), j); j += 15; if (!flag) { int i1 = c / 2 - 80; int l1 = c1 / 2 + 50; aBackground_967.method361(i1 - 73, l1 - 20); - chatTextDrawingArea.method382(0xffffff, i1, "Login", l1 + 5, true); + chatTextDrawingArea.textCenterShadow(0xffffff, i1, "Login", l1 + 5, true); i1 = c / 2 + 80; aBackground_967.method361(i1 - 73, l1 - 20); - chatTextDrawingArea.method382(0xffffff, i1, "Cancel", l1 + 5, true); + chatTextDrawingArea.textCenterShadow(0xffffff, i1, "Cancel", l1 + 5, true); } } if (loginScreenState == 3) { - chatTextDrawingArea.method382(0xffff00, c / 2, "Create a free account", c1 / 2 - 60, true); + chatTextDrawingArea.textCenterShadow(0xffff00, c / 2, "Create a free account", c1 / 2 - 60, true); int k = c1 / 2 - 35; - chatTextDrawingArea.method382(0xffffff, c / 2, "To create a new account just click", k, true); + chatTextDrawingArea.textCenterShadow(0xffffff, c / 2, "To create a new account just click", k, true); k += 15; - chatTextDrawingArea.method382(0xffffff, c / 2, "\"Cancel\" below, and click \"Existing User\".", k, true); + chatTextDrawingArea.textCenterShadow(0xffffff, c / 2, "\"Cancel\" below, and click \"Existing User\".", k, true); k += 15; - chatTextDrawingArea.method382(0xffffff, c / 2, "Log in with any credentials you want and an", k, true); + chatTextDrawingArea.textCenterShadow(0xffffff, c / 2, "Log in with any credentials you want and an", k, true); k += 15; - chatTextDrawingArea.method382(0xffffff, c / 2, "account will automatically be created for you.", k, true); + chatTextDrawingArea.textCenterShadow(0xffffff, c / 2, "account will automatically be created for you.", k, true); k += 15; int j1 = c / 2; int i2 = c1 / 2 + 50; aBackground_967.method361(j1 - 73, i2 - 20); - chatTextDrawingArea.method382(0xffffff, j1, "Cancel", i2 + 5, true); + chatTextDrawingArea.textCenterShadow(0xffffff, j1, "Cancel", i2 + 5, true); } aRSImageProducer_1109.drawGraphics(171, super.graphics, 202); if (welcomeScreenRaised) { @@ -9568,10 +9899,10 @@ public class Game extends RSApplet { NodeList class19_1 = groundArray[plane][j3][i6]; if (class19_1 != null) { for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1.reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1.reverseGetNext()) { - if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.anInt1559 != k11) { + if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.amount != k11) { continue; } - class30_sub2_sub4_sub2_3.anInt1559 = l13; + class30_sub2_sub4_sub2_3.amount = l13; break; } @@ -9605,7 +9936,7 @@ public class Game extends RSApplet { if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != unknownInt10) { Item class30_sub2_sub4_sub2_2 = new Item(); class30_sub2_sub4_sub2_2.ID = i1; - class30_sub2_sub4_sub2_2.anInt1559 = j14; + class30_sub2_sub4_sub2_2.amount = j14; if (groundArray[plane][k6][j9] == null) { groundArray[plane][k6][j9] = new NodeList(); } @@ -9793,19 +10124,19 @@ public class Game extends RSApplet { return; } if (j == 44) { - int k2 = stream.method436(); - int j5 = stream.readUnsignedWord(); + int itemID = stream.method436(); + int itemAmount = stream.readUnsignedWord(); int i8 = stream.readUnsignedByte(); int l10 = anInt1268 + (i8 >> 4 & 7); int i13 = anInt1269 + (i8 & 7); if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) { - Item class30_sub2_sub4_sub2_1 = new Item(); - class30_sub2_sub4_sub2_1.ID = k2; - class30_sub2_sub4_sub2_1.anInt1559 = j5; + Item gItem = new Item(); + gItem.ID = itemID; + gItem.amount = itemAmount; if (groundArray[plane][l10][i13] == null) { groundArray[plane][l10][i13] = new NodeList(); } - groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1); + groundArray[plane][l10][i13].insertHead(gItem); spawnGroundItem(l10, i13); } return; @@ -9824,7 +10155,7 @@ public class Game extends RSApplet { int j20 = stream.readUnsignedWord(); int i21 = stream.readUnsignedByte(); int j21 = stream.readUnsignedByte(); - if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) { + if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 0x00ffff) { l5 = l5 * 128 + 64; k8 = k8 * 128 + 64; j11 = j11 * 128 + 64; @@ -10182,8 +10513,8 @@ public class Game extends RSApplet { inStream.currentOffset = 0; socketStream.flushInputStream(inStream.buffer, pktSize); anInt1009 = 0; - anInt843 = anInt842; - anInt842 = anInt841; + prevPktType2 = prevPktType; + prevPktType = anInt841; anInt841 = pktType; if (pktType == 81) { updatePlayers(pktSize, inStream); @@ -10297,15 +10628,19 @@ public class Game extends RSApplet { } if (pktType == 134) { needDrawTabArea = true; - int k1 = inStream.readUnsignedByte(); - int i10 = inStream.method439(); - int l15 = inStream.readUnsignedByte(); - currentExp[k1] = i10; - currentStats[k1] = l15; - maxStats[k1] = 1; + int skillID = inStream.readUnsignedByte(); + int experience = inStream.method439(); + int level = inStream.readUnsignedByte(); + currentExp[skillID] = experience; + currentStats[skillID] = level; + maxStats[skillID] = 1; + // Fix for current health not updating + if (skillID == 3) { + myPlayer.currentHealth = level; + } for (int k20 = 0; k20 < 98; k20++) { - if (i10 >= anIntArray1019[k20]) { - maxStats[k1] = k20 + 2; + if (experience >= anIntArray1019[k20]) { + maxStats[skillID] = k20 + 2; } } @@ -10315,7 +10650,7 @@ public class Game extends RSApplet { if (pktType == 71) { int l1 = inStream.readUnsignedWord(); int j10 = inStream.readUnsignedByteA(); - if (l1 == 65535) { + if (l1 == 0x00ffff) { l1 = -1; } tabInterfaceIDs[j10] = l1; @@ -10326,7 +10661,7 @@ public class Game extends RSApplet { } if (pktType == 74) { int i2 = inStream.method434(); - if (i2 == 65535) { + if (i2 == 0x00ffff) { i2 = -1; } if (i2 != -1 || previousSong != 0) { @@ -10341,7 +10676,7 @@ public class Game extends RSApplet { if (pktType == 121) { int i_60_ = inStream.method436(); int i_61_ = inStream.method435(); - if (i_61_ == 65535) + if (i_61_ == 0x00ffff) i_61_ = -1; if (musicVolume != 0 && i_61_ != -1) { method56(musicVolume, false, i_60_); @@ -10924,6 +11259,7 @@ public class Game extends RSApplet { } if (!flag5 && anInt1251 == 0) { try { + // Direct message String s9 = TextInput.method525(pktSize - 13, inStream); if (l21 == 2 || l21 == 3) { pushMessage(s9, 7, "@cr2@" + TextClass.fixName(TextClass.nameForLong(l5))); @@ -10962,7 +11298,7 @@ public class Game extends RSApplet { int i6 = inStream.method434(); int i13 = inStream.readUnsignedWord(); int k18 = inStream.readUnsignedWord(); - if (k18 == 65535) { + if (k18 == 0x00ffff) { RSInterface.interfaceCache[i6].anInt233 = 0; pktType = -1; return true; @@ -11011,10 +11347,15 @@ public class Game extends RSApplet { return true; } if (pktType == 126) { - String s1 = inStream.readString(); - int k13 = inStream.method435(); - RSInterface.interfaceCache[k13].disabledText = s1; - if (RSInterface.interfaceCache[k13].parentID == tabInterfaceIDs[tabID]) { + String message = inStream.readString(); + int interfaceID = inStream.method435(); + // Update current player health (fix for refresh skill not including this) + if (interfaceID == 4016) { + myPlayer.currentHealth = Integer.parseInt(message); + currentStats[3] = Integer.parseInt(message); + } + RSInterface.interfaceCache[interfaceID].disabledText = message; + if (RSInterface.interfaceCache[interfaceID].parentID == tabInterfaceIDs[tabID]) { needDrawTabArea = true; } pktType = -1; @@ -11206,7 +11547,7 @@ public class Game extends RSApplet { } aBoolean1149 = false; pktType = -1; - return true; + return true; } if (pktType == 218) { int i8 = inStream.method438(); @@ -11339,7 +11680,7 @@ public class Game extends RSApplet { pktType = -1; return true; } - String s2 = "T1 - " + pktType + "," + pktSize + " - " + anInt842 + "," + anInt843 + " - "; + String s2 = "T1 - " + pktType + "," + pktSize + " - " + prevPktType + "," + prevPktType2 + " - "; for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) { s2 = s2 + inStream.buffer[j15] + ","; } @@ -11348,7 +11689,7 @@ public class Game extends RSApplet { } catch (IOException _ex) { dropClient(); } catch (Exception exception) { - String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843 + " - " + pktSize + "," + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - "; + String s2 = "T2 - " + pktType + "," + prevPktType + "," + prevPktType2 + " - " + pktSize + "," + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - "; for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) { s2 = s2 + inStream.buffer[j15] + ","; } @@ -11360,6 +11701,8 @@ public class Game extends RSApplet { return true; } + public static int zoom = 3; + public void method146() { anInt1265++; method47(true); @@ -11377,7 +11720,8 @@ public class Game extends RSApplet { i = anIntArray1203[4] + 128; } int k = minimapInt1 + anInt896 & 0x7ff; - setCameraPos(600 + i * 3, i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015); + // Camera zoom control + setCameraPos(600 + i * zoom, i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 70, k, anInt1015); } int j; if (!aBoolean1160) { @@ -11433,8 +11777,71 @@ public class Game extends RSApplet { method37(k2); // Allow stuff inside the tabs to work draw3dScreen(); - // Show overlays on main screen + if (showInfo) { + int debugX = 0; + int debugY = 249; + int debugItems = 4; + int debugWidth = 140; + int debugHeight = 25 + (debugItems * 15); + int fill = 0x5d5447; + int fill2 = Color.BLACK.hashCode(); + int opacity = 140; + + DrawingArea.fillArea(fill, debugY, debugWidth, debugHeight, opacity, debugX); + DrawingArea.fillArea(fill2, debugY + 1, debugWidth - 2, 16, opacity, debugX + 1); + DrawingArea.fillPixels(debugY + 18, debugHeight - 19, fill2, debugX + 1, debugWidth - 2); + chatTextDrawingArea.textLeft(Color.WHITE.darker().hashCode(), "Debug Info", debugY += 14, debugX + 3); + chatTextDrawingArea.textLeft(super.fps > 40 ? Color.YELLOW.hashCode() : super.fps > 25 ? Color.ORANGE.hashCode() : Color.RED.hashCode(), super.fps + "fps", debugY, debugX + debugWidth - chatTextDrawingArea.getTextWidth(super.fps + "fps") - 3); + + // Bump Y value + debugY += 3; + + // Draw items + Runtime runtime = Runtime.getRuntime(); + int memKB = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L); + chatTextDrawingArea.textLeftShadow(true, debugX + 4, Color.WHITE.hashCode(), "Memory:", debugY += 15); + chatTextDrawingArea.textRightShadow(true, debugX + debugWidth - 4, Color.YELLOW.hashCode(), (memKB / 1024) + "mb", debugY); + chatTextDrawingArea.textLeftShadow(true, debugX + 4, Color.WHITE.hashCode(), "Mouse:", debugY += 15); + chatTextDrawingArea.textRightShadow(true, debugX + debugWidth - 4, Color.YELLOW.hashCode(), super.mouseX + ", " + super.mouseY, debugY); + chatTextDrawingArea.textLeftShadow(true, debugX + 4, Color.WHITE.hashCode(), "Coords:", debugY += 15); + chatTextDrawingArea.textRightShadow(true, debugX + debugWidth - 4, Color.YELLOW.hashCode(), (myPlayer.smallX[0] + baseX) + ", " + (myPlayer.smallY[0] + baseY), debugY); + chatTextDrawingArea.textLeftShadow(true, debugX + 4, Color.WHITE.hashCode(), "Interface:", debugY += 15); + chatTextDrawingArea.textRightShadow(true, debugX + debugWidth - 4, Color.YELLOW.hashCode(), "" + openInterfaceID, debugY); + } + + if (customSettingShowExperiencePerHour) { + int debugItems = 2; + int debugWidth = 140; + int debugHeight = 25 + (debugItems * 15); + int debugX = 511 - debugWidth; + int debugY = 0; + int fill = 0x5d5447; + int fill2 = Color.BLACK.hashCode(); + int opacity = 140; + + DrawingArea.fillArea(fill, debugY, debugWidth, debugHeight, opacity, debugX); + DrawingArea.fillArea(fill2, debugY + 1, debugWidth - 2, 16, opacity, debugX + 1); + DrawingArea.fillPixels(debugY + 18, debugHeight - 19, fill2, debugX + 1, debugWidth - 2); + chatTextDrawingArea.textLeft(Color.WHITE.darker().hashCode(), "Experience Info", debugY += 14, debugX + 3); + + // Bump Y value + debugY += 3; + + // Calculate exp/h + long currentExpGained = calculateTotalExp(); + long expGained = currentExpGained - customSettingShowExperiencePerHourStartExp; + long expPerHour = (long) ((expGained * 3600000D) / (System.currentTimeMillis() - customSettingShowExperiencePerHourStart)); + + // Draw items + chatTextDrawingArea.textLeftShadow(true, debugX + 4, Color.WHITE.hashCode(), "Exp per hour:", debugY += 15); + chatTextDrawingArea.textRightShadow(true, debugX + debugWidth - 4, Color.YELLOW.hashCode(), intToShortLetter((int) expPerHour), debugY); + chatTextDrawingArea.textLeftShadow(true, debugX + 4, Color.WHITE.hashCode(), "Levels gained:", debugY += 15); + chatTextDrawingArea.textRightShadow(true, debugX + debugWidth - 4, Color.YELLOW.hashCode(), "" + (calculateTotalLevels() - customSettingShowExperiencePerHourStartLevels), debugY); + } + + // Draw main screen aRSImageProducer_1165.drawGraphics(4, super.graphics, 4); + if(graphicsEnabled) { xCameraPos = l; zCameraPos = i1; @@ -11645,8 +12052,8 @@ public class Game extends RSApplet { public int anInt839; public int[] anIntArray840; public int anInt841; - public int anInt842; - public int anInt843; + public int prevPktType; + public int prevPktType2; public String aString844; public int publicChatMode; public int privateChatMode; @@ -11758,7 +12165,7 @@ public class Game extends RSApplet { public volatile boolean drawingFlames; public int spriteDrawX; public int spriteDrawY; - public final int[] anIntArray965 = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff}; + public final int[] anIntArray965 = {0xffff00, 0xff0000, 0x00ff00, 0x00ffff, 0xff00ff, 0xffffff}; public Background aBackground_966; public Background aBackground_967; public final int[] anIntArray968; @@ -11932,7 +12339,6 @@ public class Game extends RSApplet { public boolean needDrawTabArea; public int unreadMessages; public static int anInt1155; - public static boolean fpsOn; public boolean loggedIn; public boolean canMute; public boolean aBoolean1159; @@ -12073,7 +12479,7 @@ public class Game extends RSApplet { public static int anInt116; public static boolean aBoolean995; public static int anInt139; - public static int musicVolume = 255; + public static int musicVolume = 0; public int[] gameScreenOffsets; public int anInt1170; public int anInt1215; @@ -12176,7 +12582,195 @@ public class Game extends RSApplet { tabID = 10; tabAreaAltered = true; break; + case KeyEvent.VK_PAGE_UP: + if (zoom > -1) + zoom--; + break; + case KeyEvent.VK_PAGE_DOWN: + if (zoom < (WorldController.drawDistance / 3)) + zoom++; + break; } } + + public long calculateTotalExp() { + long exp = 0; + for (int i = 0; i < currentExp.length; i++) { + exp += currentExp[i]; + } + return exp; + } + + public int calculateTotalLevels() { + int levels = 0; + for (int i = 0; i < maxStats.length; i++) { + levels += maxStats[i]; + } + // need to remove 4 for some reason + return levels - 4; + } + + + public void definitionSearch(String name, int type) { + int amount = 0; + int definitionResultsTotal = 0; + int definitionResultIDs[] = new int[352]; + String definitionResults[] = new String[352]; + String sType = ""; + if (type == 1) { + amount = ItemDef.totalItems; + sType = "Item"; + } else if (type == 2) { + amount = EntityDef.totalNPCs; + sType = "NPC"; + } else if (type == 3) { + amount = ObjectDef.totalObjects; + sType = "Object"; + } else { + type = 1; + amount = ItemDef.totalItems; + sType = "Item"; + } + if (type != 1) { + for (int line = 0; line < 100; line++) { + pushMessage("", 0, ""); + } + } + if (name == null || name.length() == 0) { + definitionResultsTotal = 0; + return; + } + + String search = name; + String parts[] = new String[100]; + int found = 0; + do { + int regex = search.indexOf(" "); + if (regex == -1) { + break; + } + String part = search.substring(0, regex).trim(); + if (part.length() > 0) { + parts[found++] = part.toLowerCase(); + } + search = search.substring(regex + 1); + } while (true); + search = search.trim(); + if (search.length() > 0) { + parts[found++] = search.toLowerCase(); + } + definitionResultsTotal = 0; + label0: for (int definition = 0; definition < amount; definition++) { + String result = ""; + if (type == 1) { + ItemDef item = ItemDef.forID(definition); + if (item.certTemplateID != -1 || item.name == null) { + continue; + } + result = item.name + "@bla@ - " + new String(item.description, StandardCharsets.UTF_8); + } else if (type == 2) { + EntityDef npc = EntityDef.forID(definition); + if (npc.name == null) { + continue; + } + result = npc.name; + } else if (type == 3) { + ObjectDef object = ObjectDef.forID(definition); + if (object.name == null) { + continue; + } + result = object.name; + } + for (int index = 0; index < found; index++) { + if (!result.toLowerCase().contains(parts[index])) { + continue label0; + } + } + + if (type != 1) { + pushMessage("@whi@[" + definition + "] @blu@" + result + "", 0, ""); + } + definitionResults[definitionResultsTotal] = result; + definitionResultIDs[definitionResultsTotal] = definition; + definitionResultsTotal++; + if (definitionResultsTotal >= definitionResults.length) { + break; + } + } + + if (type == 1) { + // Open bank interface + needDrawTabArea = true; + int interfaceID = 5382; + RSInterface class9_1 = RSInterface.interfaceCache[interfaceID]; + openInterface(5292); // Bank interface + RSInterface.interfaceCache[5383].disabledText = "Search results for @yel@" + name; // The Bank of Text + + int itemCount = 0; + for (int ID : definitionResultIDs) { + if (ID > 0 && itemCount < class9_1.inv.length) { + class9_1.inv[itemCount] = ID + 1; // Sets item ID; + class9_1.invStackSizes[itemCount++] = 1; // Sets item amoounts + } + } + while (itemCount < class9_1.inv.length) { + class9_1.inv[itemCount] = 0; + class9_1.invStackSizes[itemCount++] = 0; + } + } else { + pushMessage("@blu@" + sType + " @bla@search results for @blu@" + name + "@bla@ displayed above (@blu@" + definitionResultsTotal + "@bla@ results).", 0, ""); + } + } + + public void openInterface(int interfaceID) { + method60(interfaceID); + if (invOverlayInterfaceID != -1) { + invOverlayInterfaceID = -1; + needDrawTabArea = true; + tabAreaAltered = true; + } + if (backDialogID != -1) { + backDialogID = -1; + inputTaken = true; + } + if (inputDialogState != 0) { + inputDialogState = 0; + inputTaken = true; + } + if (interfaceID == 15244) { + if (Flo.getTodaysDate().contains(ClientSettings.SNOW_MONTH)) { + openInterfaceID = 15819; + } else { + openInterfaceID = 15801; + } + fullScreenInterfaceId = 15244; + } else { + openInterfaceID = interfaceID; + } + aBoolean1149 = false; + } + + public void openSideInterface(int tab, int interfaceID) { + if (interfaceID == 0x00ffff) { + interfaceID = -1; + } + tabInterfaceIDs[tab] = interfaceID; + needDrawTabArea = true; + tabAreaAltered = true; + } + + public final void mouseWheelMoved(MouseWheelEvent e) { + int notches = e.getWheelRotation(); + // If mouse over main game screen, without anything else opened + if (openInterfaceID == -1 && mouseX < 515 && mouseY < 340) { + if (notches < 0) { + if (zoom > -1) + zoom--; + } else { + if (zoom < (WorldController.drawDistance / 3)) + zoom++; + } + } + } } diff --git a/2006Scape Client/src/main/java/Item.java b/2006Scape Client/src/main/java/Item.java index 919f8e2f..70f83f79 100644 --- a/2006Scape Client/src/main/java/Item.java +++ b/2006Scape Client/src/main/java/Item.java @@ -7,7 +7,7 @@ final class Item extends Animable { @Override public final Model getRotatedModel() { ItemDef itemDef = ItemDef.forID(ID); - return itemDef.method201(anInt1559); + return itemDef.method201(amount); } public Item() { @@ -16,5 +16,5 @@ final class Item extends Animable { public int ID; public int x; public int y; - public int anInt1559; + public int amount; } diff --git a/2006Scape Client/src/main/java/ItemDef.java b/2006Scape Client/src/main/java/ItemDef.java index 4839a102..57c0d11d 100644 --- a/2006Scape Client/src/main/java/ItemDef.java +++ b/2006Scape Client/src/main/java/ItemDef.java @@ -2103,7 +2103,7 @@ public final class ItemDef { int j3 = DrawingArea.bottomY; Texture.aBoolean1464 = false; DrawingArea.initDrawingArea(32, 32, sprite2.pixels); - DrawingArea.method336(32, 0, 0, 32, 0); + DrawingArea.fillArea(32, 0, 0, 32, 0); Texture.method364(); int k3 = itemDef.modelZoom; if (k == -1) { @@ -2372,7 +2372,7 @@ public final class ItemDef { private int[] originalModelColors; public boolean membersObject; private int anInt162; - private int certTemplateID; + public int certTemplateID; private int anInt164; private int anInt165; private int anInt166; @@ -2405,7 +2405,7 @@ public final class ItemDef { private int anInt197; public int modelRotation2; private int anInt200; - private int[] stackAmounts; + public int[] stackAmounts; public int team; public static int totalItems; private int anInt204; diff --git a/2006Scape Client/src/main/java/Model.java b/2006Scape Client/src/main/java/Model.java index fd364cdd..53d5efe3 100644 --- a/2006Scape Client/src/main/java/Model.java +++ b/2006Scape Client/src/main/java/Model.java @@ -1335,7 +1335,10 @@ public final class Model extends Animable { int k2 = k1 * j + j2 * k >> 16; int l2 = anInt1650 * k >> 16; int i3 = k2 + l2; - if (i3 <= 50 || k2 >= 3500) { + // Check distance of model to camera for rendering (default 3500) + int distance = WorldController.drawDistance * 256; + distance *= 1 + (Game.zoom / 10); + if (i3 <= 50 || k2 >= distance) { return; } int j3 = l1 * l + j1 * i1 >> 16; diff --git a/2006Scape Client/src/main/java/ObjectDef.java b/2006Scape Client/src/main/java/ObjectDef.java index 663f6c8d..cf07ecfa 100644 --- a/2006Scape Client/src/main/java/ObjectDef.java +++ b/2006Scape Client/src/main/java/ObjectDef.java @@ -83,10 +83,12 @@ public final class ObjectDef { stream = null; } + public static int totalObjects; + public static void unpackConfig(StreamLoader streamLoader) { stream = new Stream(streamLoader.getDataForName("loc.dat")); Stream stream = new Stream(streamLoader.getDataForName("loc.idx")); - int totalObjects = stream.readUnsignedWord(); + totalObjects = stream.readUnsignedWord(); streamIndices = new int[totalObjects]; int i = 2; for (int j = 0; j < totalObjects; j++) { diff --git a/2006Scape Client/src/main/java/RSApplet.java b/2006Scape Client/src/main/java/RSApplet.java index c4f3d678..04f52aef 100644 --- a/2006Scape Client/src/main/java/RSApplet.java +++ b/2006Scape Client/src/main/java/RSApplet.java @@ -11,12 +11,14 @@ import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; import java.awt.event.MouseMotionListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; @SuppressWarnings("serial") -public class RSApplet extends Applet implements Runnable, MouseListener, MouseMotionListener, KeyListener, FocusListener, WindowListener { +public class RSApplet extends Applet implements Runnable, MouseListener, MouseWheelListener, MouseMotionListener, KeyListener, FocusListener, WindowListener { public static boolean ctrlDown = false; public static boolean shiftDown = false; @@ -45,6 +47,7 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo public void run() { getGameComponent().addMouseListener(this); getGameComponent().addMouseMotionListener(this); + getGameComponent().addMouseWheelListener(this); getGameComponent().addKeyListener(this); getGameComponent().addFocusListener(this); if (gameFrame != null) { @@ -296,6 +299,9 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo mouseY = j; } + @Override + public void mouseWheelMoved(MouseWheelEvent e) {} + @Override public void keyPressed(KeyEvent keyevent) { idleTime = 0; diff --git a/2006Scape Client/src/main/java/RSInterface.java b/2006Scape Client/src/main/java/RSInterface.java index f70dd5fc..032db1fd 100644 --- a/2006Scape Client/src/main/java/RSInterface.java +++ b/2006Scape Client/src/main/java/RSInterface.java @@ -25,8 +25,6 @@ public final class RSInterface { rsInterface.id = k; rsInterface.parentID = i; rsInterface.type = stream.readUnsignedByte(); - //if(rsInterface.type == 0) - // System.out.println(rsInterface.parentID+":"+k); rsInterface.atActionType = stream.readUnsignedByte(); rsInterface.anInt214 = stream.readUnsignedWord(); rsInterface.width = stream.readUnsignedWord(); diff --git a/2006Scape Client/src/main/java/Signlink.java b/2006Scape Client/src/main/java/Signlink.java index c206182f..09dc767c 100644 --- a/2006Scape Client/src/main/java/Signlink.java +++ b/2006Scape Client/src/main/java/Signlink.java @@ -404,17 +404,17 @@ public final class Signlink implements Runnable { public static boolean reporterror = true; public static String errorname = ""; public static Midi midii = new Midi(); - private static int savelen; - private static String saveReq = null; - private static byte savebuf[] = null; - public static boolean play; - private static int midiPos; - public static String midi = null; - public static int midiVolume; - public static int midifade; - private static boolean waveplay; - private static int wavepos; - public static String wave = null; - public static int wavevol; + private static int savelen; + private static String saveReq = null; + private static byte savebuf[] = null; + public static boolean play; + private static int midiPos; + public static String midi = null; + public static int midiVolume; + public static int midifade; + private static boolean waveplay; + private static int wavepos; + public static String wave = null; + public static int wavevol; } diff --git a/2006Scape Client/src/main/java/TextDrawingArea.java b/2006Scape Client/src/main/java/TextDrawingArea.java index 6eeb08f4..1f2358bc 100644 --- a/2006Scape Client/src/main/java/TextDrawingArea.java +++ b/2006Scape Client/src/main/java/TextDrawingArea.java @@ -75,16 +75,20 @@ public final class TextDrawingArea extends DrawingArea { } } - public void method380(String s, int i, int j, int k) { - method385(j, s, k, i - method384(s)); + public void textRight(int i, String s, int k, int l) { + textLeft(i, s, k, l - method384(s)); } - public void drawText(int i, String s, int k, int l) { - method385(i, s, k, l - method384(s) / 2); + public void textCenter(int i, String s, int k, int l) { + textLeft(i, s, k, l - method384(s) / 2); } - public void method382(int i, int j, String s, int l, boolean flag) { - method389(flag, j - getTextWidth(s) / 2, i, s, l); + public void textCenterShadow(int _color, int _x, String s, int _y, boolean _shadow) { + textLeftShadow(_shadow, _x - getTextWidth(s) / 2, _color, s, _y); + } + + public void textRightShadow(boolean _shadow, int _x, int _color, String s, int _y) { + textLeftShadow(_shadow, _x - getTextWidth(s), _color, s, _y); } public int getTextWidth(String s) { @@ -114,7 +118,7 @@ public final class TextDrawingArea extends DrawingArea { return j; } - public void method385(int i, String s, int j, int l) { + public void textLeft(int i, String s, int j, int l) { if (s == null) { return; } @@ -180,37 +184,37 @@ public final class TextDrawingArea extends DrawingArea { } - public void method389(boolean flag1, int i, int j, String s, int k) { + public void textLeftShadow(boolean _shadow, int _x, int _color, String s, int _y) { aBoolean1499 = false; - int l = i; + int l = _x; if (s == null) { return; } - k -= anInt1497; + _y -= anInt1497; for (int i1 = 0; i1 < s.length(); i1++) { if (s.charAt(i1) == '@' && i1 + 4 < s.length() && s.charAt(i1 + 4) == '@') { int j1 = getColorByName(s.substring(i1 + 1, i1 + 4)); if (j1 != -1) { - j = j1; + _color = j1; } i1 += 4; } else { char c = s.charAt(i1); if (c != ' ') { - if (flag1) { - method392(aByteArrayArray1491[c], i + anIntArray1494[c] + 1, k + anIntArray1495[c] + 1, anIntArray1492[c], anIntArray1493[c], 0); + if (_shadow) { + method392(aByteArrayArray1491[c], _x + anIntArray1494[c] + 1, _y + anIntArray1495[c] + 1, anIntArray1492[c], anIntArray1493[c], 0); } try { - method392(aByteArrayArray1491[c], i + anIntArray1494[c], k + anIntArray1495[c], anIntArray1492[c], anIntArray1493[c], j); + method392(aByteArrayArray1491[c], _x + anIntArray1494[c], _y + anIntArray1495[c], anIntArray1492[c], anIntArray1493[c], _color); } catch (Exception e) { } } - i += anIntArray1496[c]; + _x += anIntArray1496[c]; } } if (aBoolean1499) { - DrawingArea.method339(k + (int) (anInt1497 * 0.69999999999999996D), 0x800000, i - l, l); + DrawingArea.drawHorizontalLine(_y + (int) (anInt1497 * 0.69999999999999996D), 0x800000, _x - l, l); } } diff --git a/2006Scape Client/src/main/java/WorldController.java b/2006Scape Client/src/main/java/WorldController.java index efaf05af..73150242 100644 --- a/2006Scape Client/src/main/java/WorldController.java +++ b/2006Scape Client/src/main/java/WorldController.java @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) final class WorldController { + public static int drawDistance = 25; public WorldController(int ai[][][]) { int i = 104;// was parameter @@ -794,7 +795,7 @@ final class WorldController { anInt498 = l; anInt493 = k / 2; anInt494 = l / 2; - boolean aflag[][][][] = new boolean[9][32][53][53]; + boolean aflag[][][][] = new boolean[9][32][256][256]; for (int i1 = 128; i1 <= 384; i1 += 32) { for (int j1 = 0; j1 < 2048; j1 += 64) { anInt458 = Model.modelIntArray1[i1]; @@ -803,8 +804,8 @@ final class WorldController { anInt461 = Model.modelIntArray2[j1]; int l1 = (i1 - 128) / 32; int j2 = j1 / 64; - for (int l2 = -26; l2 <= 26; l2++) { - for (int j3 = -26; j3 <= 26; j3++) { + for (int l2 = -(drawDistance + 1); l2 <= (drawDistance + 1); l2++) { + for (int j3 = -(drawDistance + 1); j3 <= (drawDistance + 1); j3++) { int k3 = l2 * 128; int i4 = j3 * 128; boolean flag2 = false; @@ -816,7 +817,7 @@ final class WorldController { break; } - aflag[l1][j2][l2 + 25 + 1][j3 + 25 + 1] = flag2; + aflag[l1][j2][l2 + drawDistance + 1][j3 + drawDistance + 1] = flag2; } } @@ -827,19 +828,19 @@ final class WorldController { for (int k1 = 0; k1 < 8; k1++) { for (int i2 = 0; i2 < 32; i2++) { - for (int k2 = -25; k2 < 25; k2++) { - for (int i3 = -25; i3 < 25; i3++) { + for (int k2 = -drawDistance; k2 < drawDistance; k2++) { + for (int i3 = -drawDistance; i3 < drawDistance; i3++) { boolean flag1 = false; label0 : for (int l3 = -1; l3 <= 1; l3++) { for (int j4 = -1; j4 <= 1; j4++) { - if (aflag[k1][i2][k2 + l3 + 25 + 1][i3 + j4 + 25 + 1]) { + if (aflag[k1][i2][k2 + l3 + drawDistance + 1][i3 + j4 + drawDistance + 1]) { flag1 = true; - } else if (aflag[k1][(i2 + 1) % 31][k2 + l3 + 25 + 1][i3 + j4 + 25 + 1]) { + } else if (aflag[k1][(i2 + 1) % 31][k2 + l3 + drawDistance + 1][i3 + j4 + drawDistance + 1]) { flag1 = true; - } else if (aflag[k1 + 1][i2][k2 + l3 + 25 + 1][i3 + j4 + 25 + 1]) { + } else if (aflag[k1 + 1][i2][k2 + l3 + drawDistance + 1][i3 + j4 + drawDistance + 1]) { flag1 = true; } else { - if (!aflag[k1 + 1][(i2 + 1) % 31][k2 + l3 + 25 + 1][i3 + j4 + 25 + 1]) { + if (!aflag[k1 + 1][(i2 + 1) % 31][k2 + l3 + drawDistance + 1][i3 + j4 + drawDistance + 1]) { continue; } flag1 = true; @@ -849,7 +850,7 @@ final class WorldController { } - aBooleanArrayArrayArrayArray491[k1][i2][k2 + 25][i3 + 25] = flag1; + aBooleanArrayArrayArrayArray491[k1][i2][k2 + drawDistance][i3 + drawDistance] = flag1; } } @@ -904,19 +905,19 @@ final class WorldController { anInt453 = i / 128; anInt454 = j / 128; anInt447 = i1; - anInt449 = anInt453 - 25; + anInt449 = anInt453 - drawDistance; if (anInt449 < 0) { anInt449 = 0; } - anInt451 = anInt454 - 25; + anInt451 = anInt454 - drawDistance; if (anInt451 < 0) { anInt451 = 0; } - anInt450 = anInt453 + 25; + anInt450 = anInt453 + drawDistance; if (anInt450 > anInt438) { anInt450 = anInt438; } - anInt452 = anInt454 + 25; + anInt452 = anInt454 + drawDistance; if (anInt452 > anInt439) { anInt452 = anInt439; } @@ -928,7 +929,7 @@ final class WorldController { for (int k2 = anInt451; k2 < anInt452; k2++) { Ground class30_sub3 = aclass30_sub3[i2][k2]; if (class30_sub3 != null) { - if (class30_sub3.anInt1321 > i1 || !aBooleanArrayArray492[i2 - anInt453 + 25][k2 - anInt454 + 25] && anIntArrayArrayArray440[k1][i2][k2] - l < 2000) { + if (class30_sub3.anInt1321 > i1 || !aBooleanArrayArray492[i2 - anInt453 + drawDistance][k2 - anInt454 + drawDistance] && anIntArrayArrayArray440[k1][i2][k2] - l < 50) { class30_sub3.aBoolean1322 = false; class30_sub3.aBoolean1323 = false; class30_sub3.anInt1325 = 0; @@ -947,11 +948,11 @@ final class WorldController { for (int l1 = anInt442; l1 < anInt437; l1++) { Ground aclass30_sub3_1[][] = groundArray[l1]; - for (int l2 = -25; l2 <= 0; l2++) { + for (int l2 = -drawDistance; l2 <= 0; l2++) { int i3 = anInt453 + l2; int k3 = anInt453 - l2; if (i3 >= anInt449 || k3 < anInt450) { - for (int i4 = -25; i4 <= 0; i4++) { + for (int i4 = -drawDistance; i4 <= 0; i4++) { int k4 = anInt454 + i4; int i5 = anInt454 - i4; if (i3 >= anInt449) { @@ -995,11 +996,11 @@ final class WorldController { for (int j2 = anInt442; j2 < anInt437; j2++) { Ground aclass30_sub3_2[][] = groundArray[j2]; - for (int j3 = -25; j3 <= 0; j3++) { + for (int j3 = -drawDistance; j3 <= 0; j3++) { int l3 = anInt453 + j3; int j4 = anInt453 - j3; if (l3 >= anInt449 || j4 < anInt450) { - for (int l4 = -25; l4 <= 0; l4++) { + for (int l4 = -drawDistance; l4 <= 0; l4++) { int j5 = anInt454 + l4; int k5 = anInt454 - l4; if (l3 >= anInt449) { @@ -1691,15 +1692,15 @@ final class WorldController { for (int k = 0; k < j; k++) { Class47 class47 = aclass47[k]; if (class47.anInt791 == 1) { - int l = class47.anInt787 - anInt453 + 25; + int l = class47.anInt787 - anInt453 + drawDistance; if (l < 0 || l > 50) { continue; } - int k1 = class47.anInt789 - anInt454 + 25; + int k1 = class47.anInt789 - anInt454 + drawDistance; if (k1 < 0) { k1 = 0; } - int j2 = class47.anInt790 - anInt454 + 25; + int j2 = class47.anInt790 - anInt454 + drawDistance; if (j2 > 50) { j2 = 50; } @@ -1731,15 +1732,15 @@ final class WorldController { continue; } if (class47.anInt791 == 2) { - int i1 = class47.anInt789 - anInt454 + 25; + int i1 = class47.anInt789 - anInt454 + drawDistance; if (i1 < 0 || i1 > 50) { continue; } - int l1 = class47.anInt787 - anInt453 + 25; + int l1 = class47.anInt787 - anInt453 + drawDistance; if (l1 < 0) { l1 = 0; } - int k2 = class47.anInt788 - anInt453 + 25; + int k2 = class47.anInt788 - anInt453 + drawDistance; if (k2 > 50) { k2 = 50; } @@ -1771,20 +1772,20 @@ final class WorldController { } else if (class47.anInt791 == 4) { int j1 = class47.anInt796 - anInt456; if (j1 > 128) { - int i2 = class47.anInt789 - anInt454 + 25; + int i2 = class47.anInt789 - anInt454 + drawDistance; if (i2 < 0) { i2 = 0; } - int l2 = class47.anInt790 - anInt454 + 25; + int l2 = class47.anInt790 - anInt454 + drawDistance; if (l2 > 50) { l2 = 50; } if (i2 <= l2) { - int i3 = class47.anInt787 - anInt453 + 25; + int i3 = class47.anInt787 - anInt453 + drawDistance; if (i3 < 0) { i3 = 0; } - int l3 = class47.anInt788 - anInt453 + 25; + int l3 = class47.anInt788 - anInt453 + drawDistance; if (l3 > 50) { l3 = 50; } @@ -2103,7 +2104,7 @@ final class WorldController { private int anInt488; private final int[][] anIntArrayArray489 = {new int[16], {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1}, {0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0}, {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1}, {1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1}}; private final int[][] anIntArrayArray490 = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, {12, 8, 4, 0, 13, 9, 5, 1, 14, 10, 6, 2, 15, 11, 7, 3}, {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, {3, 7, 11, 15, 2, 6, 10, 14, 1, 5, 9, 13, 0, 4, 8, 12}}; - private static boolean[][][][] aBooleanArrayArrayArrayArray491 = new boolean[8][32][51][51]; + private static boolean[][][][] aBooleanArrayArrayArrayArray491 = new boolean[8][32][256][256]; private static boolean[][] aBooleanArrayArray492; private static int anInt493; private static int anInt494; diff --git a/2006Scape Server/data/cfg/npcDefinitions.xml b/2006Scape Server/data/cfg/npcDefinitions.xml index a0d50039..379bd4fe 100644 --- a/2006Scape Server/data/cfg/npcDefinitions.xml +++ b/2006Scape Server/data/cfg/npcDefinitions.xml @@ -69451,7 +69451,7 @@ 3157 Bill Teach - It's an NPC. + Bill Teach the pirate. 0 1 false diff --git a/2006Scape Server/data/cfg/spawns.json b/2006Scape Server/data/cfg/spawns.json index 959c8b59..7877ba72 100644 --- a/2006Scape Server/data/cfg/spawns.json +++ b/2006Scape Server/data/cfg/spawns.json @@ -23853,7 +23853,7 @@ "walk": 0, "height": 0 }, - { + { "maxHit": 0, "strength": 0, "attack": 0, @@ -23863,7 +23863,17 @@ "walk": 0, "height": 0 }, - { + { + "maxHit": 0, + "strength": 0, + "attack": 0, + "x": 3792, + "y": 3560, + "id": 1704, + "walk": 0, + "height": 0 + }, + { "maxHit": 0, "strength": 0, "attack": 0, @@ -23973,7 +23983,7 @@ "walk": 1, "height": 0 }, - { + { "maxHit": 0, "strength": 0, "attack": 0, @@ -23982,6 +23992,26 @@ "id": 3155, "walk": 1, "height": 0 + }, + { + "maxHit": 0, + "strength": 0, + "attack": 0, + "x": 3714, + "y": 3499, + "id": 3156, + "walk": 1, + "height": 1 + }, + { + "maxHit": 0, + "strength": 0, + "attack": 0, + "x": 3683, + "y": 2948, + "id": 3157, + "walk": 1, + "height": 1 }, { "maxHit": 0, diff --git a/2006Scape Server/src/main/java/com/rs2/GameConstants.java b/2006Scape Server/src/main/java/com/rs2/GameConstants.java index 3fb0564a..aedc818b 100644 --- a/2006Scape Server/src/main/java/com/rs2/GameConstants.java +++ b/2006Scape Server/src/main/java/com/rs2/GameConstants.java @@ -15,8 +15,8 @@ public class GameConstants { MESSAGE_DELAY = 6000, MAX_PLAYERS = 200, REQ_AMOUNT = 150; public final static boolean SOUND = true, - GUILDS = true, WORLD_LIST_FIX = false, - PARTY_ROOM_DISABLED = true, + GUILDS = true, + PARTY_ROOM_DISABLED = false, PRINT_OBJECT_ID = false, EXPERIMENTS = false; public static int[] SIDEBARS = { 2423, 3917, 638, 3213, 1644, 5608, 1151, @@ -24,7 +24,7 @@ public class GameConstants { public static boolean TUTORIAL_ISLAND = false, MEMBERS_ONLY = false, sendServerPackets = false, - CLUES_ENABLED = false; + CLUES_ENABLED = true; public final static int[] FUN_WEAPONS = { 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2471, 2473, 2474, 2475, @@ -52,7 +52,7 @@ public class GameConstants { public final static int CASTLE_WARS_Y = 3087; - public static double XP_RATE = 1; + public static double XP_RATE = 10; public final static int SAVE_TIMER = 120; // save every x seconds diff --git a/2006Scape Server/src/main/java/com/rs2/GameEngine.java b/2006Scape Server/src/main/java/com/rs2/GameEngine.java index 06cdbf87..98da5729 100644 --- a/2006Scape Server/src/main/java/com/rs2/GameEngine.java +++ b/2006Scape Server/src/main/java/com/rs2/GameEngine.java @@ -231,6 +231,7 @@ public class GameEngine { CastleWars.process(); FightPits.process(); pestControl.process(); + objectHandler.process(); CycleEventHandler.getSingleton().process(); PlayersOnlineWebsite.addUpdatePlayersOnlineTask(); if(GameConstants.WEBSITE_TOTAL_CHARACTERS_INTEGRATION) { diff --git a/2006Scape Server/src/main/java/com/rs2/game/bots/Bot.java b/2006Scape Server/src/main/java/com/rs2/game/bots/Bot.java index fdba28a9..b0854eed 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/bots/Bot.java +++ b/2006Scape Server/src/main/java/com/rs2/game/bots/Bot.java @@ -17,14 +17,13 @@ public class Bot { public Bot(String username, Integer x, Integer y, Integer z) { botClient = new Client(null); - botClient.playerName = username; botClient.playerName = username; botClient.playerName2 = botClient.playerName; - // TODO: randomize the bot passwords - botClient.playerPass = "bot_password"; - botClient.properName = Character.toUpperCase(username.charAt(1)) + username.substring(2); + // TODO: randomize the bot passwords + botClient.playerPass = generatePassword(10); + botClient.saveFile = true; botClient.saveCharacter = true; @@ -33,9 +32,11 @@ public class Bot { botClient.npcCanAttack = false; botClient.canWalkTutorial = true; botClient.tutorialProgress = 36; + botClient.privateChat = 2; GameEngine.playerHandler.newPlayerClient(botClient); - loadPlayerInfo(botClient, username, "bot_password", false); + // password doesn't matter as it's not doing a real login + loadPlayerInfo(botClient, username, botClient.playerPass, false); if (x != null) { botClient.getPlayerAssistant().movePlayer(x, y, z); @@ -96,4 +97,17 @@ public class Bot { return price + "gp"; } } + + public String generatePassword(int targetStringLength) { + int leftLimit = 97; // letter 'a' + int rightLimit = 122; // letter 'z' + Random random = new Random(); + StringBuilder buffer = new StringBuilder(targetStringLength); + for (int i = 0; i < targetStringLength; i++) { + int randomLimitedInt = leftLimit + (int) + (random.nextFloat() * (rightLimit - leftLimit + 1)); + buffer.append((char) randomLimitedInt); + } + return buffer.toString(); + } } diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/combat/magic/SpellTeleport.java b/2006Scape Server/src/main/java/com/rs2/game/content/combat/magic/SpellTeleport.java index 5c743e2e..30365d58 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/combat/magic/SpellTeleport.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/combat/magic/SpellTeleport.java @@ -14,7 +14,7 @@ public enum SpellTeleport { SENNTISTEN(60, 50245, 70, 3321, 3335, 0, new int[][] {{566, 1}, {563, 2}}, "ancient"), KHARYLL(66, 50253, 76, 3493, 3472, 0, new int[][] {{565, 1}, {563, 2}}, "ancient"), LASSAR(72, 51005, 82, 3006, 3471, 0, new int[][] {{563, 2}, {555, 4}}, "ancient"), - DAREEYAK(78, 51013, 88, 3161, 3671, 0, new int[][] {{563, 2}, {554, 3}, {556, 2}}, "ancient"), + DAREEYAK(78, 51013, 88, 2966, 3697, 0, new int[][] {{563, 2}, {554, 3}, {556, 2}}, "ancient"), CARRALLANGAR(84, 51023, 94, 3157, 3669, 0, new int[][] {{566, 2}, {563, 2}}, "ancient"), ANNAKARL(90, 51031, 100, 3286, 3884, 0, new int[][] {{565, 2}, {563, 2}}, "ancient"), GHORROCK(96, 51039, 106, 2977, 3873, 0, new int[][] {{563, 2}, {555, 8}}, "ancient"); diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/random/Balloons.java b/2006Scape Server/src/main/java/com/rs2/game/content/random/Balloons.java index 0964bc3d..b734c009 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/random/Balloons.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/random/Balloons.java @@ -1,6 +1,5 @@ package com.rs2.game.content.random; -import java.awt.Point; import java.util.Random; import com.rs2.GameEngine; import com.rs2.game.objects.Objects; @@ -9,45 +8,61 @@ import com.rs2.game.players.Player; public class Balloons extends Objects { static Random r = new Random(); - public static int item, amount; - public static int x, y; + public static int minID = 115; + public static int maxID = 120; + public int item, amount; - @SuppressWarnings("static-access") - public Balloons(int id, int x, int y, int height, int face, int type, - int ticks, int item, int amount) { - super(id, x, y, height, face, type, ticks); - this.x = x; - this.y = y; + public Balloons(int x, int y, int height, int face, int type, int ticks, int item, int amount) { + super(getRandomBalloon(), x, y, height, face, type, ticks); + GameEngine.objectHandler.addObject(this); + GameEngine.objectHandler.placeObject(this); this.item = item; this.amount = amount; } - public static void popBalloon(Player player, int x, int y) { - PartyRoom.coords.remove(getCoords()); - Balloons empty = remove(x, y); - GameEngine.itemHandler.createGroundItem(player, item, x, y, amount, player.playerId); - item = 0; - amount = 0; - GameEngine.objectHandler.addObject(empty); - GameEngine.objectHandler.placeObject(empty); + public static Balloons getBalloon(int x, int y, int height, int item, int amount) { + return new Balloons(x, y, 0, 0, 10, 0, item, amount); + } + + public static Balloons getBalloon(int x, int y, int item, int amount) { + return getBalloon(x, y, 0, item, amount); + } + + public static Balloons getEmpty(int x, int y, int height) { + return getBalloon(x, y, height, 0, 0); + } + + public static Balloons getEmpty(int x, int y) { + return getEmpty(x, y, 0); + } + + public void popBalloon(Player player) { + remove(); + if (item > 0 && amount > 0) { + GameEngine.itemHandler.createGroundItem(player, item, objectX, objectY, amount, player.playerId); + item = 0; + amount = 0; + } player.startAnimation(794); } - public static Point getCoords() { - return new Point(x, y); + public static int getRandomBalloon() { + // between 115 and 122 + return 115 + r.nextInt(8); } - public static Balloons getBalloon(int item, int amount) { - return new Balloons(115 + r.nextInt(5), 2730 + r.nextInt(13), - 3462 + r.nextInt(13), 0, 0, 10, 0, item, amount); + public int getPoppedBalloon() { + // between 115 and 122 + return objectId + 8; } - public static Balloons getEmpty() { - return new Balloons(115 + r.nextInt(5), 2730 + r.nextInt(13), - 3462 + r.nextInt(13), 0, 0, 10, 0, 0, 0); - } - - public static Balloons remove(int x, int y) { - return new Balloons(-1, x, y, 0, 0, 10, 0, 0, 0); + public void remove() { + // Spawn the popped balloons + Objects poppedBallons = new Objects(getPoppedBalloon(), objectX, objectY, objectHeight, objectFace, objectType, 0); + GameEngine.objectHandler.addObject(poppedBallons); + GameEngine.objectHandler.placeObject(poppedBallons); + // Remove the popped balloons + Objects empty = new Objects(-1, objectX, objectY, objectHeight, objectFace, objectType, 4); + GameEngine.objectHandler.addObject(empty); } } diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/random/PartyRoom.java b/2006Scape Server/src/main/java/com/rs2/game/content/random/PartyRoom.java index 38fc8506..e61939d9 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/random/PartyRoom.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/random/PartyRoom.java @@ -9,15 +9,18 @@ import com.rs2.game.items.ItemConstants; import com.rs2.game.items.ItemData; import com.rs2.game.objects.Objects; import com.rs2.game.players.Player; +import com.rs2.game.players.PlayerHandler; +import com.rs2.world.Boundary; public class PartyRoom { - + static int mainInterfaceID = 2156; static Random r = new Random(); - static int[] roomItems = new int[50]; - static int[] roomItemsN = new int[50]; + static int[] roomItems = new int[216]; + static int[] roomItemsN = new int[216]; + static Balloons[][] balloons = new Balloons[15][14]; + static Point corner = new Point(2730, 3462); static long lastAnnouncment; static int announcmentFrequency = 1; // announcment frequency in mins - static ArrayList coords = new ArrayList(); public static int getAmount() { int amount = 0; @@ -37,47 +40,76 @@ public class PartyRoom { } public static void dropAll() { + int maxTry = 150; int trys = 0; int amount = getAmount(); if (amount < 1) { return; } - for (int x = 0; x < roomItems.length; x++) { - if (roomItemsN[x] > 0) { - Balloons b = null; - do { - b = Balloons.getBalloon(roomItems[x], roomItemsN[x]); + for (int i = 0; i < roomItems.length; i++) { + int split = r.nextInt(4); + while (roomItemsN[i] > 0) { + int x = r.nextInt(balloons.length); + int y = r.nextInt(balloons[0].length); + int amt = split > 0 ? Math.max(1, (int) (Math.random() * roomItemsN[i])) : roomItemsN[i]; + // If already balloons there, or on the table, retry + while ((balloons[x][y] != null || Boundary.isIn(corner.x + x, corner.y + y, Boundary.PARTY_ROOM_TABLE)) && trys < maxTry) { + x = r.nextInt(balloons.length); + y = r.nextInt(balloons[0].length); trys++; - } while (coords.contains(Balloons.getCoords()) && trys < 100); - GameEngine.objectHandler.addObject(b); - GameEngine.objectHandler.placeObject(b); + } + + if (trys >= maxTry) { + break; + } + + balloons[x][y] = Balloons.getBalloon(corner.x + x, corner.y + y, roomItems[i], amt); + GameEngine.objectHandler.addObject(balloons[x][y]); + GameEngine.objectHandler.placeObject(balloons[x][y]); + + roomItemsN[i] -= amt; + if (roomItemsN[i] <= 0) { + roomItems[i] = 0; + } + split--; } - if (trys > 100) { - break; - } - roomItems[x] = 0; - roomItemsN[x] = 0; } trys = 0; - for (int x = 0; x < amount * 2; x++) { - Objects o; - do { - o = Balloons.getEmpty(); - } while (coords.contains(new Point(o.objectX, o.objectY)) - && trys < 100); - if (trys > 100) { + for (int i = 0; i < amount * 2; i++) { + int x = r.nextInt(balloons.length); + int y = r.nextInt(balloons[0].length); + + // If already balloons there, or on the table, retry + while ((balloons[x][y] != null || Boundary.isIn(corner.x + x, corner.y + y, Boundary.PARTY_ROOM_TABLE)) && trys < maxTry) { + x = r.nextInt(balloons.length); + y = r.nextInt(balloons[0].length); + trys++; + } + + if (trys >= maxTry) { break; } - GameEngine.objectHandler.addObject(o); - GameEngine.objectHandler.placeObject(o); + + balloons[x][y] = Balloons.getEmpty(corner.x + x, corner.y + y); + GameEngine.objectHandler.addObject(balloons[x][y]); + GameEngine.objectHandler.placeObject(balloons[x][y]); } - coords.clear(); } - public static int arraySlot(int[] array, int target) { + public static void popBalloon(Player player, int x, int y) { + x = x - corner.x; + y = y - corner.y; + Balloons balloon = balloons[x][y]; + if (balloon != null) { + balloon.popBalloon(player); + } + balloons[x][y] = null; + } + + public static int arraySlot(int[] array, int itemID) { int spare = -1; for (int x = 0; x < array.length; x++) { - if (array[x] == target) { + if (array[x] == itemID && ItemData.itemStackable[itemID]) { return x; } else if (spare == -1 && array[x] <= 0) { spare = x; @@ -90,10 +122,10 @@ public class PartyRoom { if (!GameConstants.PARTY_ROOM_DISABLED) { updateGlobal(player); updateDeposit(player); - player.getItemAssistant().resetItems(5064); - player.getPacketSender().sendFrame248(2156, 5063); + player.getItemAssistant().resetItems(5064); // Player inventory + player.getPacketSender().sendFrame248(mainInterfaceID, 5063); // Party Drop Chest interface, Deposit interface } else { - player.getPacketSender().sendMessage("The partyroom has been disabled."); + player.getPacketSender().sendMessage("The partyroom is currently disabled."); } } @@ -103,8 +135,7 @@ public class PartyRoom { if (ItemData.itemStackable[c.party[x]]) { int slot = arraySlot(roomItems, c.party[x]); if (slot < 0) { - c.getPacketSender().sendMessage( - "Theres not enough space left in the chest."); + c.getPacketSender().sendMessage("Theres not enough space left in the chest."); break; } if (roomItems[slot] != c.party[x]) { @@ -118,11 +149,9 @@ public class PartyRoom { } else { int left = c.partyN[x]; for (int y = 0; y < left; y++) { - int slot = arraySlot(roomItems, -2); + int slot = arraySlot(roomItems, c.party[x]); if (slot < 0) { - c.getPacketSender() - .sendMessage( - "Theres not enough space left in the chest."); + c.getPacketSender().sendMessage("Theres not enough space left in the chest."); break; } roomItems[slot] = c.party[x]; @@ -136,14 +165,19 @@ public class PartyRoom { } } updateDeposit(c); - updateGlobal(c); + updateAll(); } - // public static void updateAll() { - // for (int x = 0; x < PlayerHandler.getPlayers().length; x++) { - // updateGlobal((Client) PlayerHandler.getPlayers()[x]); - // } - // } + public static void updateAll() { + for (Player p : PlayerHandler.players) { + if (p == null) { + continue; + } + if (p.lastMainFrameInterface == mainInterfaceID) { + updateGlobal(p); + } + } + } public static void fix(Player c) { for (int x = 0; x < 8; x++) { @@ -156,7 +190,6 @@ public class PartyRoom { } public static void depositItem(Player player, int id, int amount) { - int slot = arraySlot(player.party, id); for (int i : ItemConstants.ITEM_TRADEABLE) { if (i == id) { player.getPacketSender().sendMessage("You can't deposit this item."); @@ -167,57 +200,66 @@ public class PartyRoom { return; } } - if (player.getItemAssistant().getItemAmount(id) < amount) { - amount = player.getItemAssistant().getItemAmount(id); - } + + amount = Math.min(player.getItemAssistant().getItemAmount(id), amount); + if (!player.getItemAssistant().playerHasItem(id, amount)) { player.getPacketSender().sendMessage("You don't have that many items!"); return; } - if (slot == -1) { - player.getPacketSender().sendMessage("You cant deposit more than 8 items at once."); - return; - } - player.getItemAssistant().deleteItem(id, amount); - if (player.party[slot] != id) { - player.party[slot] = id; - player.partyN[slot] = amount; + + if (player.getItemAssistant().isStackable(id)) { + int slot = arraySlot(player.party, id); + if (slot == -1) { + player.getPacketSender().sendMessage("You can only deposit up to 8 items at once."); + return; + } + + player.getItemAssistant().deleteItem(id, amount); + if (player.party[slot] != id) { + player.party[slot] = id; + player.partyN[slot] = amount; + } else { + player.party[slot] = id; + player.partyN[slot] += amount; + } } else { - player.party[slot] = id; - player.partyN[slot] += amount; + for (int i = 0; i < amount; i ++) { + int slot = arraySlot(player.party, id); + if (slot == -1) { + player.getPacketSender().sendMessage("You can only deposit up to 8 items at once."); + updateDeposit(player); + return; + } + + player.getItemAssistant().deleteItem(id, 1); + player.party[slot] = id; + player.partyN[slot] = 1; + } } updateDeposit(player); } - public static void withdrawItem(Player c, int slot) { - if (c.party[slot] >= 0 && c.getItemAssistant().freeSlots() > 0) { - c.getItemAssistant().addItem(c.party[slot], c.partyN[slot]); - c.party[slot] = 0; - c.partyN[slot] = 0; + public static void withdrawItem(Player c, int slot, int amount) { + int itemID = c.party[slot]; + amount = Math.min(c.partyN[slot], amount); + if (c.party[slot] >= 0 && c.getItemAssistant().freeSlots(itemID, amount) > 0) { + c.getItemAssistant().addItem(c.party[slot], amount); + c.partyN[slot] -= amount; + if (c.partyN[slot] <= 0) { + c.party[slot] = 0; + } } updateDeposit(c); - updateGlobal(c); } public static void updateDeposit(Player player) { player.getItemAssistant().resetItems(5064); - for (int x = 0; x < 8; x++) { - if (player.partyN[x] <= 0) { - itemOnInterface(player, 2274, x, -1, 0); - } else { - itemOnInterface(player, 2274, x, player.party[x], player.partyN[x]); - } - } + player.getPacketSender().sendUpdateItems(2274, player.party, player.partyN); } public static void updateGlobal(Player player) { - for (int x = 0; x < roomItems.length; x++) { - if (roomItemsN[x] <= 0) { - itemOnInterface(player, 2273, x, -1, 0); - } else { - itemOnInterface(player, 2273, x, roomItems[x], roomItemsN[x]); - } - } + player.getPacketSender().sendUpdateItems(2273, roomItems, roomItemsN); } public static void itemOnInterface(Player player, int frame, int slot, int id, int amount) { diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/skills/agility/AgilityShortcut.java b/2006Scape Server/src/main/java/com/rs2/game/content/skills/agility/AgilityShortcut.java index f36bd5a1..8bbe9e18 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/skills/agility/AgilityShortcut.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/skills/agility/AgilityShortcut.java @@ -10,7 +10,7 @@ import com.rs2.game.players.Player; public class AgilityShortcut { - private static final int WALK = 1, MOVE = 2, AGILITY = 3; + private static final int WALK = 1, MOVE = 2, AGILITY = 3, DOWN = 4, UP = 5; private static void handleAgility(Player player, int x, int y, int levelReq, int anim, int walk, String message) { if (player.playerLevel[GameConstants.AGILITY] < levelReq) { @@ -18,15 +18,21 @@ public class AgilityShortcut { return; } switch (walk) { - case 1: + case WALK: player.getPlayerAssistant().walkTo(x, y); break; - case 2: + case MOVE: player.getPlayerAssistant().movePlayer(x, y, player.heightLevel); break; - case 3: + case AGILITY: player.getAgility().walk(x, y, anim, -1); break; + case DOWN: + player.getPlayerAssistant().movePlayer(x, y, player.heightLevel - 1); + break; + case UP: + player.getPlayerAssistant().movePlayer(x, y, player.heightLevel + 1); + break; } if (anim != 0 && anim != -1) { player.startAnimation(anim); @@ -181,6 +187,18 @@ public class AgilityShortcut { "You pass through the agility shortcut."); } break; + case 9307: + if (player.absY == 9888) { + handleAgility(player, 3670, 9888, 58, Agility.CLIMB_UP_EMOTE, UP, + "You jump up the weathered wall."); + } + break; + case 9308: + if (player.absY == 9888) { + handleAgility(player, 3671, 9888, 58, Agility.CLIMB_DOWN_EMOTE, DOWN, + "You jump down the weathered wall."); + } + break; case 9309: if (player.absY == 3309) { handleAgility(player, 2948, 3313, 26, 844, MOVE, diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/skills/crafting/GemCutting.java b/2006Scape Server/src/main/java/com/rs2/game/content/skills/crafting/GemCutting.java index f087aca3..fee1b0bf 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/skills/crafting/GemCutting.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/skills/crafting/GemCutting.java @@ -40,8 +40,7 @@ public class GemCutting extends CraftingData { public void execute(CycleEventContainer container) { if (Misc.random(2) == 0 && itemUsed > 1624 && itemUsed < 1630 || usedWith > 1624 && usedWith < 1630 && Misc.random(2) == 0) { player.getPacketSender().sendMessage("You fail to cut the gem."); - player.getItemAssistant().addItem(1633, 1); - player.getItemAssistant().deleteItem(itemId, 1); + player.getItemAssistant().replaceItem(itemId, 1633); player.getPlayerAssistant().addSkillXP(1, 12); } if (player.isCrafting) { diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/skills/prayer/Ectofuntus.java b/2006Scape Server/src/main/java/com/rs2/game/content/skills/prayer/Ectofuntus.java index 5447a5c9..8e2cf11a 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/skills/prayer/Ectofuntus.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/skills/prayer/Ectofuntus.java @@ -4,6 +4,7 @@ import com.rs2.GameConstants; import com.rs2.event.CycleEvent; import com.rs2.event.CycleEventContainer; import com.rs2.event.CycleEventHandler; +import com.rs2.game.items.ItemAssistant; import com.rs2.game.players.Player; /** @@ -18,13 +19,35 @@ public class Ectofuntus { * Data storage for ectofuntus */ public enum EctofuntusData { - BONES(526, 4255, 18), BIG_BONES(532, 4257, 60), BABYDRAGON_BONES(534, - 4260, 120), DRAGON_BONES(536, 4261, 288), DAGANNOTH_BONES(6729, - 6728, 500); + BONES(526, 4255, 18), + BURNT_BONES(528, 4258, 18), + WOLF_BONES(2859, 4262, 18), + BAT_BONES(530, 4256, 21.2), + BIG_BONES(532, 4257, 60), + JOGRE_BONES(3125, 4271, 60), + BURNT_JOGRE_BONES(3127, 4259, 60), + BABY_DRAGON_BONES(534, 4260, 120), + DRAGON_BONES(536, 4261, 288), + SMALL_NINJA_MONKEY_BONES(3179, 4263, 20), + MEDIUM_NINJA_MONKEY_BONES(3180, 4264, 20), + SMALL_ZOMBIE_MONKEY_BONES(3183, 4268, 20), + LARGE_ZOMBIE_MONKEY_BONES(3181, 4269, 20), + GORILLA_MONKEY_BONES(3182, 4265, 20), + BEARDED_GORILLA_MONKEY_BONES(3182, 4266, 20), + MONKEY_BONES(3185, 4267, 20), + SKELETON_BONES(2530, 4270, 20), + ZOGRE_BONES(4812, 4852, 90), + FAYRG_BONES(4830, 4853, 336), + RAURG_BONES(4832, 4854, 384), + OURG_BONES(4834, 4855, 560), + SHAIKAHAN_BONES(3123, 5615, 100), + DAGANNOTH_BONES(6729, 6728, 500), + WYVERN_BONES(6812, 6810, 200); - int boneId, bonemealId, worshipExperience; + int boneId, bonemealId; + double worshipExperience; - EctofuntusData(int boneId, int bonemealId, int worshipExperience) { + EctofuntusData(int boneId, int bonemealId, double worshipExperience) { this.boneId = boneId; this.bonemealId = bonemealId; this.worshipExperience = worshipExperience; @@ -38,26 +61,11 @@ public class Ectofuntus { return bonemealId; } - public int getWorshipExperience() { + public double getWorshipExperience() { return worshipExperience; } } - /** - * Get the name of the bone used - * - * @param boneId - * @return - */ - public static String getBoneName(int boneId) { - for (EctofuntusData ectofuntus : EctofuntusData.values()) { - if (ectofuntus.boneId == boneId) { - return ectofuntus.name().replaceAll("_", " ").toLowerCase(); - } - } - return ""; - } - /** * Put bones in the loader * @@ -80,7 +88,7 @@ public class Ectofuntus { player.getItemAssistant().deleteItem(ectofuntus.getBoneId(), 1); player.ectofuntusBoneCrusherState = "Loaded"; player.ectofuntusBoneUsed = ectofuntus.getBoneId(); - player.getPacketSender().sendMessage("You load the " + getBoneName(ectofuntus.getBoneId()) + " into the loader."); + player.getPacketSender().sendMessage("You load the " + ItemAssistant.getItemName(ectofuntus.getBoneId()) + " into the loader."); container.stop(); } @@ -158,18 +166,28 @@ public class Ectofuntus { * @param objectId * @param itemId */ - public static void handleEctofuntus(Player player, int objectId) { + public static void handleEctofuntus(Player player) { player.turnPlayerTo(3660, 3520); + boolean worshipped = false; for (final EctofuntusData ectofuntus : EctofuntusData.values()) { - if (objectId == ECTOFUNTUS && player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) && player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) { + if (!worshipped && player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) && player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) { + worshipped = true; CycleEventHandler.getSingleton().addEvent(player, new CycleEvent() { @Override public void execute(CycleEventContainer container) { - player.getItemAssistant().deleteItem(ectofuntus.getBonemealId(), 1); + if (player.isMoving || !player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) || !player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) { + container.stop(); + return; + } + player.getItemAssistant().replaceItem(ectofuntus.getBonemealId(), 1931); + player.getItemAssistant().replaceItem(BUCKET_OF_SLIME, 1925);// Bucket player.startAnimation(WORSHIP); player.getPlayerAssistant().addSkillXP(ectofuntus.getWorshipExperience(), GameConstants.PRAYER); player.getPacketSender().sendMessage("You pray to the ectofuntus."); - container.stop(); + player.ectofuntusWorshipped++; + if (player.isMoving || !player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) || !player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) { + container.stop(); + } } @Override @@ -180,6 +198,10 @@ public class Ectofuntus { }, 3); } } + + if (!worshipped) { + player.getPacketSender().sendMessage("You'll need ectoplasm and bonemeal to worship the Ectofuntus."); + } } /** @@ -217,23 +239,25 @@ public class Ectofuntus { /** * item constants */ - private final static int POT = 1931; + public final static int POT = 1931; public final static int BUCKET = 1925; - private final static int BUCKET_OF_SLIME = 4286; + public final static int BUCKET_OF_SLIME = 4286; /** * object constants */ - private final static int ECTOFUNTUS = 5282; - private final static int LOADER = 11162; - private final static int[] SLIME = { 5461, 5462 }; + public final static int ECTOFUNTUS = 5282; + public final static int LOADER = 11162; + public final static int GRINDER = 11163; + public final static int BIN = 11164; + public final static int[] SLIME = { 5461, 5462 }; /** * animation constants */ - private final static int WORSHIP = 1651; - private final static int WHEEL = 1648; - private final static int BONES = 1649; - private final static int BUCKET_FILL = 895; + public final static int WORSHIP = 1651; + public final static int WHEEL = 1648; + public final static int BONES = 1649; + public final static int BUCKET_FILL = 895; } \ No newline at end of file diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/skills/woodcutting/Woodcutting.java b/2006Scape Server/src/main/java/com/rs2/game/content/skills/woodcutting/Woodcutting.java index 8f7ab400..78008f23 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/skills/woodcutting/Woodcutting.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/skills/woodcutting/Woodcutting.java @@ -37,7 +37,7 @@ public class Woodcutting { MAGIC(new int[] {1306}, 7401, 75, 250, 1513, 150, 3), EVERGREEN(new int[] {1319, 1318, 1315, 1316, 1332}, 1341, 1, 25, 1511, 11, 100), ACHEY(new int[] {2023}, 3371, 1, 25, 1511, 11, 100), - DRAMEN(new int[] {1292}, 1341, 1, 25, 771, 45, 100); + DRAMEN(new int[] {1292}, 1341, 36, 0, 771, 45, 100); private int[] treeId; private int stumpId, levelReq, xpRecieved, logRecieved, respawnTime, cutChance; diff --git a/2006Scape Server/src/main/java/com/rs2/game/dialogues/DialogueHandler.java b/2006Scape Server/src/main/java/com/rs2/game/dialogues/DialogueHandler.java index 433a11e9..b30e76a7 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/dialogues/DialogueHandler.java +++ b/2006Scape Server/src/main/java/com/rs2/game/dialogues/DialogueHandler.java @@ -14,6 +14,7 @@ import com.rs2.game.content.skills.slayer.Slayer; import com.rs2.game.content.traveling.CarpetTravel; import com.rs2.game.content.traveling.Sailing; import com.rs2.game.globalworldobjects.PassDoor; +import com.rs2.game.items.ItemConstants; import com.rs2.game.npcs.NpcHandler; import com.rs2.game.objects.impl.OtherObjects; import com.rs2.game.players.Player; @@ -4912,6 +4913,72 @@ public class DialogueHandler { player.nextChat = 0; break; + case 1390: + if (player.getItemAssistant().playerHasEquipped(ItemConstants.AMULET, 552)) { + sendPlayerChat("Can I have the tokens I have earned?"); + player.nextChat = 1391; + } else { + sendNpcChat1("Wooooo. Oooooh!", player.talkingNpc, "Ghost disciple"); + player.nextChat = 0; + } + break; + + case 1391: + int amount = player.ectofuntusWorshipped * 5; + if (amount <= 0) { + sendNpcChat1("You haven't earned any tokens yet.", player.talkingNpc, "Ghost disciple"); + } else if (player.getItemAssistant().freeSlots(4278, amount) <= 0) { + sendNpcChat1("You don't have enough space in your inventory.", player.talkingNpc, "Ghost disciple"); + } else { + sendNpcChat1("Certainly, mortal. Here's " + amount + " ecto-tokens.", player.talkingNpc, "Ghost disciple"); + player.getItemAssistant().addItem(4278, amount); + player.ectofuntusWorshipped = 0; + } + player.nextChat = 0; + break; + + case 1400: + if (!player.getItemAssistant().playerHasEquipped(ItemConstants.AMULET, 552)) { + sendNpcChat1("Wooooo. Oooooh!", player.talkingNpc, "Ghost Captain"); + player.nextChat = 0; + } else { + if (player.talkingNpc == 1704) { + sendNpcChat1("Would you like a ride to Port Phasmatys?", player.talkingNpc, "Ghost Captain"); + } else { + sendNpcChat1("Would you like a ride to Dragontooth Island?", player.talkingNpc, "Ghost Captain"); + } + player.nextChat = 1401; + } + break; + + case 1401: + sendOption( + "Yes please." + (player.talkingNpc == 1705 ? " (25 Ecto-tokens)" : ""), + "No thanks."); + player.dialogueAction = 185; + break; + + case 1402: + sendNpcChat1("You don't have enough Ecto-tokens.", player.talkingNpc, "Ghost Captain"); + player.nextChat = 0; + break; + + case 1410: + if (player.talkingNpc == 3157) { + sendNpcChat1("Would you like a ride to Port Phasmatys?", player.talkingNpc, "Bill Teach"); + } else { + sendNpcChat1("Would you like a ride to Mos Le'Harmless?", player.talkingNpc, "Bill Teach"); + } + player.nextChat = 1411; + break; + + case 1411: + sendOption( + "Yes please.", + "No thanks."); + player.dialogueAction = 186; + break; + case 2995: player.canWalkTutorial = false; sendStatement( diff --git a/2006Scape Server/src/main/java/com/rs2/game/dialogues/DialogueOptions.java b/2006Scape Server/src/main/java/com/rs2/game/dialogues/DialogueOptions.java index be9ff6ff..4200552e 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/dialogues/DialogueOptions.java +++ b/2006Scape Server/src/main/java/com/rs2/game/dialogues/DialogueOptions.java @@ -561,6 +561,22 @@ public class DialogueOptions { } else if (player.dialogueAction == 184) { player.getDialogueHandler().sendDialogues(624, player.npcType); return; + } else if (player.dialogueAction == 185) { + if (player.talkingNpc == 1704) { + player.getPlayerAssistant().movePlayer(3702, 3487, 0); + } else if (player.getItemAssistant().playerHasItem(4278, 25)) { + // if player has enough ecto tokens + player.getItemAssistant().deleteItem(4278, 25); + player.getPlayerAssistant().movePlayer(3791, 3560, 0); + } else { + player.getDialogueHandler().sendDialogues(1402, player.npcType); + } + } else if (player.dialogueAction == 186) { + if (player.talkingNpc == 3157) { + player.getPlayerAssistant().movePlayer(3714, 3499, 1); + } else { + player.getPlayerAssistant().movePlayer(3683, 2948, 1); + } } else if (player.dialogueAction == 3204) { player.getItemAssistant().deleteItem(1929, 1); player.getItemAssistant().deleteItem(1933, 1); diff --git a/2006Scape Server/src/main/java/com/rs2/game/items/ItemAssistant.java b/2006Scape Server/src/main/java/com/rs2/game/items/ItemAssistant.java index 4784d968..e3a48b35 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/items/ItemAssistant.java +++ b/2006Scape Server/src/main/java/com/rs2/game/items/ItemAssistant.java @@ -103,9 +103,13 @@ public class ItemAssistant { } public void replaceItem(int itemToReplace, int replaceWith) { - if(playerHasItem(itemToReplace)) { - deleteItem(itemToReplace, 1); - addItem(replaceWith, 1); + replaceItem(itemToReplace, replaceWith, 1); + } + + public void replaceItem(int itemToReplace, int replaceWith, int amount) { + if(playerHasItem(itemToReplace, amount)) { + deleteItem(itemToReplace, amount); + addItem(replaceWith, amount); } } @@ -1705,6 +1709,7 @@ public class ItemAssistant { } public void resetBank() { + player.getPacketSender().sendString("The Bank of " + GameConstants.SERVER_NAME, 5383, true); if (player.getOutStream() != null) { player.getOutStream().createFrameVarSizeWord(53); player.getOutStream().writeWord(5382); // bank @@ -2480,6 +2485,18 @@ public class ItemAssistant { return freeS; } + public int freeSlots(int itemID, int amount) { + int freeS = 0; + for (int i = 0; i < player.playerItems.length; i ++) { + int _id = player.playerItems[i]; + int _amt = player.playerItemsN[i]; + if (_id <= 0 || (_id == itemID && isStackable(_id) && _amt + amount <= Integer.MAX_VALUE)) { + freeS++; + } + } + return freeS; + } + public int findItem(int id, int[] items, int[] amounts) { for (int i = 0; i < player.playerItems.length; i++) { if (items[i] - 1 == id && amounts[i] > 0) { diff --git a/2006Scape Server/src/main/java/com/rs2/game/items/ItemConstants.java b/2006Scape Server/src/main/java/com/rs2/game/items/ItemConstants.java index d0031a60..425856fd 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/items/ItemConstants.java +++ b/2006Scape Server/src/main/java/com/rs2/game/items/ItemConstants.java @@ -104,7 +104,7 @@ public class ItemConstants { 2416, 2417, 88, 1540, 2714, 432, 433, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 300, 775, 776, 777, 6180, 6181, 6182, 6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, - 290, 666, 667 }; + 290, 666, 667, 4251, 4252, 4278}; public final static int[] ITEM_TRADEABLE = { 5317, 3842, 3844, 3840, 8844, 8845, 8846, 8847, 8848, 8849, 8850, 10551, 6570, 7462, 7461, 7460, 7459, @@ -120,15 +120,15 @@ public class ItemConstants { 4218, 4219, 4220, 4221, 4222, 4223, 4224, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 2714, 432, 433, 290, 5075, 5074, 5073, 5071, 5070, 7413, 6529, 4067, 2996, 1464, 666, 667, - 2412, 2413, 2414, 771, 772}; + 2412, 2413, 2414, 771, 772, 4251, 4252, 4278}; public final static int[] ITEM_UNALCHABLE = { 995, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 7583, 1566, 7585, 2528, 4214, 4212, 2714, 432, 433, 300, 775, 776, 777, 6180, 6181, 6182, - 6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, 290, 666, 667}; + 6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, 290, 666, 667, 4278}; public final static int[] ITEM_BANKABLE = {2528, 4447}; - public final static int[] DESTROYABLE_ITEMS = {775, 776, 777, 2528, 6570, 2714, 432, 433, 300, 666}; + public final static int[] DESTROYABLE_ITEMS = {775, 776, 777, 2528, 6570, 2714, 432, 433, 300, 666, 4251, 4252, 4278}; } diff --git a/2006Scape Server/src/main/java/com/rs2/game/items/UseItem.java b/2006Scape Server/src/main/java/com/rs2/game/items/UseItem.java index 42582cb6..af32896e 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/items/UseItem.java +++ b/2006Scape Server/src/main/java/com/rs2/game/items/UseItem.java @@ -35,11 +35,11 @@ import com.rs2.util.Misc; public class UseItem { public static void itemOnObject(Player c, int objectID, int objectX, int objectY, int itemId) { - final int goodPosXType1 = objectX - 5; - final int goodPosXType2 = objectX + 5; - final int goodPosYType1 = objectY - 5; - final int goodPosYType2 = objectY + 5; - if (c.absX >= goodPosXType1 && c.absX <= goodPosXType2 && c.absY >= goodPosYType1 && c.absY <= goodPosYType2) { + final int minX = objectX - 5; + final int maxX = objectX + 5; + final int minY = objectY - 5; + final int maxY = objectY + 5; + if (c.absX >= minX && c.absX <= maxX && c.absY >= minY && c.absY <= maxY) { c.turnPlayerTo(objectX, objectY); } else { c.getPlayerAssistant().playerWalk(objectX, objectY); diff --git a/2006Scape Server/src/main/java/com/rs2/game/items/impl/Fillables.java b/2006Scape Server/src/main/java/com/rs2/game/items/impl/Fillables.java index 2e972f48..6ccdcc01 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/items/impl/Fillables.java +++ b/2006Scape Server/src/main/java/com/rs2/game/items/impl/Fillables.java @@ -1,5 +1,7 @@ package com.rs2.game.items.impl; +import com.rs2.game.content.skills.prayer.Ectofuntus; + public class Fillables { public static boolean canFill(int id, int oid) { @@ -38,6 +40,8 @@ public class Fillables { return 1823; case 6667: return 6668; + case 4252: + return 4251; } return -1; } @@ -70,6 +74,8 @@ public class Fillables { return "waterskin"; case 6667: return "fishbowl"; + case 4252: + return "ectophial"; } return "There was a problem with your current action, please report this to Mod Andrew."; } @@ -108,6 +114,8 @@ public class Fillables { case 6232: case 2864: return "fountain"; + case Ectofuntus.ECTOFUNTUS: + return "ectofuntus"; } return "Error"; } diff --git a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcActions.java b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcActions.java index 16d8d75e..c4925d5d 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcActions.java +++ b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcActions.java @@ -56,6 +56,13 @@ public class NpcActions { case 389 : //thormac player.getDialogueHandler().sendDialogues(3574, npcType); break; + case 1686 : // Ghost Desciple + player.getDialogueHandler().sendDialogues(1390, npcType); + break; + case 1704 : // Ghost Captain + case 1705 : // Ghost Captain + player.getDialogueHandler().sendDialogues(1400, npcType); + break; case 2324 : case 2323 : @@ -86,6 +93,11 @@ public class NpcActions { case 2238: player.getDialogueHandler().sendDialogues(3214, npcType); break; + + case 3156 : // Bill Teach + case 3157 : // Bill Teach + player.getDialogueHandler().sendDialogues(1410, npcType); + break; case 958: player.getDialogueHandler().sendDialogues(3208, npcType); diff --git a/2006Scape Server/src/main/java/com/rs2/game/objects/ObjectsActions.java b/2006Scape Server/src/main/java/com/rs2/game/objects/ObjectsActions.java index 8d20027c..cbb6081d 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/objects/ObjectsActions.java +++ b/2006Scape Server/src/main/java/com/rs2/game/objects/ObjectsActions.java @@ -12,7 +12,6 @@ import com.rs2.game.content.minigames.PestControl; import com.rs2.game.content.minigames.castlewars.CastleWarObjects; import com.rs2.game.content.minigames.castlewars.CastleWars; import com.rs2.game.content.quests.QuestRewards; -import com.rs2.game.content.random.Balloons; import com.rs2.game.content.random.PartyRoom; import com.rs2.game.content.randomevents.FreakyForester; import com.rs2.game.content.skills.agility.AgilityShortcut; @@ -30,6 +29,7 @@ import com.rs2.game.content.traveling.DesertCactus; import com.rs2.game.globalworldobjects.ClimbOther; import com.rs2.game.globalworldobjects.PassDoor; import com.rs2.game.globalworldobjects.ClimbOther.ClimbData; +import com.rs2.game.items.ItemAssistant; import com.rs2.game.items.impl.LightSources; import com.rs2.game.npcs.NpcHandler; import com.rs2.game.npcs.impl.MilkCow; @@ -91,8 +91,8 @@ public class ObjectsActions { if (player.getWerewolfAgility().werewolfCourse(objectType)) { return; } - if (objectType >= 115 && objectType <= 121) { - Balloons.popBalloon(player, objectX, objectY); + if (Boundary.isIn(player, Boundary.PARTY_ROOM) && objectType >= 115 && objectType <= 122) { + PartyRoom.popBalloon(player, objectX, objectY); return; } if (objectType >= 5103 && objectType <= 5107) { @@ -123,6 +123,14 @@ public class ObjectsActions { return; } switch (objectType) { + case 6969: // Swamp Boaty + if (player.objectX == 3523 && player.objectY == 3284) + player.getPlayerAssistant().movePlayer(3499, 3380, 0); + break; + case 6970: // Swamp Boaty + if (player.objectX == 3498 && player.objectY == 3377) + player.getPlayerAssistant().movePlayer(3522, 3284, 0); + break; case 6615: if (player.absY == 2809) { player.getPlayerAssistant().movePlayer(player.absX, 2810, 0); @@ -130,11 +138,11 @@ public class ObjectsActions { player.getPlayerAssistant().movePlayer(player.absX, 2809, 0); } break; - case 11163: + case Ectofuntus.GRINDER: Ectofuntus.useBoneGrinder(player); break; - case 11164: + case Ectofuntus.BIN: Ectofuntus.emptyBin(player); break; case 6: @@ -752,21 +760,8 @@ public class ObjectsActions { case 5281: player.getPlayerAssistant().movePlayer(3666, 3517, 0); break; - case 5282: // Ectofuntus Worship - if (player.getItemAssistant().playerHasItem(4286) && player.getItemAssistant().playerHasItem(4255)) - { - player.startAnimation(1651); - player.getPacketSender().sendMessage("You put some ectoplasm and bonemeal into the Ectofuntus, and worship it."); - player.getItemAssistant().deleteItem(4286, 1); - player.getItemAssistant().deleteItem(4255, 1); - player.getItemAssistant().addItem(1925, 1); - player.getItemAssistant().addItem(1931, 1); - player.getPlayerAssistant().addSkillXP(18, GameConstants.PRAYER); - } - else - { - player.getPacketSender().sendMessage("You'll need ectoplasm and bonemeal to worship the Ectofuntus."); - } + case Ectofuntus.ECTOFUNTUS: // Ectofuntus Worship + Ectofuntus.handleEctofuntus(player); break; case 12982: @@ -961,6 +956,8 @@ public class ObjectsActions { case 9326: case 9321: case 993: + case 9307: + case 9308: AgilityShortcut.processAgilityShortcut(player); break; @@ -2644,6 +2641,50 @@ public class ObjectsActions { if (player.getItemAssistant().hasFreeSlots(1)) player.getItemAssistant().addItem(2413, 1); break; + case 11209: + player.getPlayerAssistant().movePlayer(3712, 3496, 1); + break; + case 11210: + player.getPlayerAssistant().movePlayer(3709, 3496, 0); + break; + case 11211: + player.getPlayerAssistant().movePlayer(3684, 2950, 1); + break; + case 11212: + player.getPlayerAssistant().movePlayer(3684, 2953, 0); + break; + case 11289: + if (objectX == 3686 && objectY == 2946) + player.getPlayerAssistant().movePlayer(3687, 2946, 2); + if (objectX == 3686 && objectY == 2950) + player.getPlayerAssistant().movePlayer(3687, 2950, 2); + if (objectX == 3712 && objectY == 3494) + player.getPlayerAssistant().movePlayer(3712, 3493, 2); + if (objectX == 3716 && objectY == 3494) + player.getPlayerAssistant().movePlayer(3716, 3493, 2); + break; + case 11290: + if (objectX == 3686 && objectY == 2946) + player.getPlayerAssistant().movePlayer(3685, 2946, 1); + if (objectX == 3686 && objectY == 2950) + player.getPlayerAssistant().movePlayer(3685, 2950, 1); + if (objectX == 3712 && objectY == 3494) + player.getPlayerAssistant().movePlayer(3712, 3495, 1); + if (objectX == 3716 && objectY == 3494) + player.getPlayerAssistant().movePlayer(3716, 3495, 1); + break; + case 11308: + if (objectX == 3714 && objectY == 3502) + player.getPlayerAssistant().movePlayer(3714, 3503, 1); + if (objectX == 3678 && objectY == 2948) + player.getPlayerAssistant().movePlayer(3677, 2948, 1); + break; + case 11309: + if (objectX == 3714 && objectY == 3502) + player.getPlayerAssistant().movePlayer(3714, 3503, 0); + if (objectX == 3678 && objectY == 2948) + player.getPlayerAssistant().movePlayer(3677, 2948, 0); + break; } } @@ -2764,6 +2805,18 @@ public class ObjectsActions { case 12537: Climbing.climbUp(player); break; + + case Ectofuntus.GRINDER: + if (player.ectofuntusBoneCrusherState.equals("Empty")) { + player.getPacketSender().sendMessage("You need to load some bones."); + } else if (player.ectofuntusBoneCrusherState.equals("Loaded")) { + player.getPacketSender().sendMessage(ItemAssistant.getItemName(player.ectofuntusBoneUsed) + " loaded and ready to be grinded."); + } else if (player.ectofuntusBoneCrusherState.equals("Bin")) { + player.getPacketSender().sendMessage("Bonemeal is ready to be collected from the bin."); + } else { + player.getPacketSender().sendMessage("Ghostly forces are playing with the machinery."); + } + break; case 14921: case 9390: diff --git a/2006Scape Server/src/main/java/com/rs2/game/objects/impl/Climbing.java b/2006Scape Server/src/main/java/com/rs2/game/objects/impl/Climbing.java index d044a043..8d0e3e45 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/objects/impl/Climbing.java +++ b/2006Scape Server/src/main/java/com/rs2/game/objects/impl/Climbing.java @@ -422,7 +422,7 @@ public class Climbing { case 1738: if (client.objectX == 2728 && client.objectY == 3460 && client.heightLevel == 0) { - client.getPlayerAssistant().movePlayer(2749, 3462, 1); + client.getPlayerAssistant().movePlayer(2729, 3462, 1); client.resetWalkingQueue(); } else if (client.objectX == 2746 && client.objectY == 3460 && client.heightLevel == 0) { diff --git a/2006Scape Server/src/main/java/com/rs2/game/players/Player.java b/2006Scape Server/src/main/java/com/rs2/game/players/Player.java index 6f2c90bf..7c707812 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/players/Player.java +++ b/2006Scape Server/src/main/java/com/rs2/game/players/Player.java @@ -908,17 +908,17 @@ public abstract class Player { if (System.currentTimeMillis() - restoreStatsDelay > 60000) { restoreStatsDelay = System.currentTimeMillis(); - for (int level = 0; level < playerLevel.length; level++) { - if (playerLevel[level] < getLevelForXP(playerXP[level])) { - if (level != 5) { // prayer doesn't restore - playerLevel[level] += 1; - getPacketSender().setSkillLevel(level, playerLevel[level], playerXP[level]); - getPlayerAssistant().refreshSkill(level); + for (int skill = 0; skill < playerLevel.length; skill++) { + if (playerLevel[skill] < getLevelForXP(playerXP[skill])) { + if (skill != 5) { // prayer doesn't restore + playerLevel[skill] += 1; + getPacketSender().setSkillLevel(skill, playerLevel[skill], playerXP[skill]); + getPlayerAssistant().refreshSkill(skill); } - } else if (playerLevel[level] > getLevelForXP(playerXP[level])) { - playerLevel[level] -= 1; - getPacketSender().setSkillLevel(level, playerLevel[level], playerXP[level]); - getPlayerAssistant().refreshSkill(level); + } else if (playerLevel[skill] > getLevelForXP(playerXP[skill])) { + playerLevel[skill] -= 1; + getPacketSender().setSkillLevel(skill, playerLevel[skill], playerXP[skill]); + getPlayerAssistant().refreshSkill(skill); } } } @@ -1632,7 +1632,7 @@ public abstract class Player { crystalBowArrowCount, playerMagicBook, teleGfx, teleEndAnimation, teleHeight, teleX, teleY, rangeItemUsed, killingNpcIndex, totalDamageDealt, globalDamageDealt, oldNpcIndex, fightMode, attackTimer, - bowSpecShot; + bowSpecShot, ectofuntusWorshipped; public boolean magicFailed, oldMagicFailed; /** * End @@ -2083,6 +2083,11 @@ public abstract class Player { if (checkRangeDistance()) { distance = gatherRangeDistance(distance); } + + return ((objectX-playerX <= distance && objectX-playerX >= -distance) && (objectY-playerY <= distance && objectY-playerY >= -distance)); + } + + public boolean goodObjectDistance(int objectX, int objectY, int playerX, int playerY, int distance) { return ((objectX-playerX <= distance && objectX-playerX >= -distance) && (objectY-playerY <= distance && objectY-playerY >= -distance)); } diff --git a/2006Scape Server/src/main/java/com/rs2/game/players/PlayerAssistant.java b/2006Scape Server/src/main/java/com/rs2/game/players/PlayerAssistant.java index e543f0f2..98c1d4a2 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/players/PlayerAssistant.java +++ b/2006Scape Server/src/main/java/com/rs2/game/players/PlayerAssistant.java @@ -127,14 +127,14 @@ public class PlayerAssistant { private String[][] welcomeMessages = { {"Remember to vote daily to help " + GameConstants.SERVER_NAME + "", "Every vote counts! :)"}, - {"Not a member of our discord community?", "Join our discord at: https://discord.gg/Nk9WQUK"}, + {"Not a member of our discord community?", "Join our discord at: https://discord.gg/hZ6VfWG"}, {"Do you have any bugs that you would like to report?", "Report them on our discord or message a staff member. :)"}, {"Want to help the server grow?", "Remember to vote daily and invite your friends!"} }; public void showMap() { - int posisition = (player.getX() / 64 - 46) + (player.getY() / 64 - 49) * 6; - player.getPacketSender().sendConfig(106, posisition); + int position = (player.getX() / 64 - 46) + (player.getY() / 64 - 49) * 6; + player.getPacketSender().sendConfig(106, position); player.getPacketSender().showInterface(5392); } @@ -1019,7 +1019,7 @@ public class PlayerAssistant { for (Player p : PlayerHandler.players) { if (p != null && p.isActive) { Client o = (Client) p; - o.getPlayerAssistant().updatePM(player.playerId, 1); + o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD); } } boolean pmLoaded = false; @@ -1028,7 +1028,7 @@ public class PlayerAssistant { if (friend != 0) { for (int i2 = 1; i2 < PlayerHandler.players.length; i2++) { Player p = PlayerHandler.players[i2]; - if (p != null && p.isActive + if (p != null && !p.isBot && p.isActive && Misc.playerNameToInt64(p.playerName) == friend) { Client o = (Client) p; if (player.playerRights >= 2 @@ -1037,7 +1037,7 @@ public class PlayerAssistant { && o.getPlayerAssistant() .isInPM(Misc .playerNameToInt64(player.playerName))) { - player.getPacketSender().loadPM(friend, 1); + player.getPacketSender().loadPM(friend, GameConstants.WORLD); pmLoaded = true; } break; @@ -1052,7 +1052,7 @@ public class PlayerAssistant { Player p = PlayerHandler.players[i1]; if (p != null && p.isActive) { Client o = (Client) p; - o.getPlayerAssistant().updatePM(player.playerId, 1); + o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD); } } } @@ -1819,7 +1819,7 @@ public class PlayerAssistant { player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@."); player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source and pull requests are welcome!"); player.getPacketSender().sendMessage("Source code: github.com/2006-Scape/2006Scape"); - player.getPacketSender().sendMessage("Discord: discord.gg/4zrA2Wy"); + player.getPacketSender().sendMessage("Discord: https://discord.gg/hZ6VfWG"); player.getDialogueHandler().sendDialogues(3115, 2224); player.isRunning2 = false; player.autoRet = 1; @@ -1972,6 +1972,8 @@ public class PlayerAssistant { if (skill == 5) { player.getPacketSender().sendString("" + player.playerLevel[GameConstants.PRAYER] + "/" + getLevelForXP(player.playerXP[GameConstants.PRAYER]) + "", 687);// Prayer } + // Update skill data + player.getPacketSender().setSkillLevel(skill, player.playerLevel[skill], player.playerXP[skill]); } public int getXPForLevel(int level) { diff --git a/2006Scape Server/src/main/java/com/rs2/game/players/PlayerSave.java b/2006Scape Server/src/main/java/com/rs2/game/players/PlayerSave.java index 0d513b73..ce196133 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/players/PlayerSave.java +++ b/2006Scape Server/src/main/java/com/rs2/game/players/PlayerSave.java @@ -409,6 +409,9 @@ public class PlayerSave { case "fightMode": player.fightMode = Integer.parseInt(token2); break; + case "ectofuntusWorshipped": + player.ectofuntusWorshipped = Integer.parseInt(token2); + break; } break; case 3: @@ -777,6 +780,8 @@ public class PlayerSave { characterfile.newLine(); characterfile.write("fightMode = " + player.fightMode); characterfile.newLine(); + characterfile.write("ectofuntusWorshipped = " + player.ectofuntusWorshipped); + characterfile.newLine(); String voidStatus = ""; for (int voidS : player.voidStatus){ voidStatus += voidS + "\t"; diff --git a/2006Scape Server/src/main/java/com/rs2/net/PacketSender.java b/2006Scape Server/src/main/java/com/rs2/net/PacketSender.java index a0928f57..a033ef4e 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/PacketSender.java +++ b/2006Scape Server/src/main/java/com/rs2/net/PacketSender.java @@ -30,29 +30,48 @@ public class PacketSender { } public PacketSender sendUpdateItems(int frame, Item[] items) { - player.getOutStream().createFrameVarSizeWord(53); - player.getOutStream().writeWord(frame); - player.getOutStream().writeWord(items.length); - Item[] var6 = items; + if (player.getOutStream() != null) { + player.getOutStream().createFrameVarSizeWord(53); + player.getOutStream().writeWord(frame); + player.getOutStream().writeWord(items.length); + } + for (int i = 0; i < items.length; i++) { - Item item = var6[i]; - if (item == null) { - player.getOutStream().writeByte(0); - player.getOutStream().writeWordBigEndianA(0); - } else { + Item item = items[i]; + if (player.getOutStream() != null) { if (item.getCount() > 254) { player.getOutStream().writeByte(255); player.getOutStream().writeDWord_v2(item.getCount()); } else { player.getOutStream().writeByte(item.getCount()); } - - player.getOutStream().writeWordBigEndianA(item.getId()); } + int id = item.getId() + 1; + if (item.getCount() < 1) { + id = 0; + } + if (id > GameConstants.ITEM_LIMIT || id < 0) { + id = GameConstants.ITEM_LIMIT; + } + if (player.getOutStream() != null) { + player.getOutStream().writeWordBigEndianA(id); + } + } + + if (player.getOutStream() != null) { + player.getOutStream().endFrameVarSizeWord(); + player.flushOutStream(); } return this; } + public PacketSender sendUpdateItems(int frame, int[] itemIDs, int[] itemAmounts) { + Item[] items = new Item[itemIDs.length]; + for(int i = 0; i < itemIDs.length; i++) { + items[i] = new Item(itemIDs[i], itemAmounts[i]); + } + return sendUpdateItems(frame, items); + } public PacketSender loginPlayer() { player.getPlayerAssistant().loginScreen(); @@ -101,7 +120,7 @@ public class PacketSender { player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@."); player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source! Pull requests are welcome"); player.getPacketSender().sendMessage("Source code at github.com/2006-Scape/2006Scape"); - player.getPacketSender().sendMessage("Join our Discord: discord.gg/4zrA2Wy"); + player.getPacketSender().sendMessage("Join our Discord: https://discord.gg/hZ6VfWG"); /*if (!hasBankpin) { //Kind of annoying. Maybe add Random % 10 or something. getActionSender().sendMessage("You do not have a bank pin it is highly recommended you set one."); }*/ @@ -146,7 +165,7 @@ public class PacketSender { player.getPacketSender().sendFrame107(); // reset screen player.getPacketSender().setChatOptions(0, 0, 0); // reset private messaging options player.correctCoordinates(); - player.getPacketSender().showOption(4, 0, "Trade With", 3); + player.getPacketSender().showOption(4, 0, "Trade with", 3); player.getPacketSender().showOption(5, 0, "Follow", 4); player.getItemAssistant().resetItems(3214); player.getItemAssistant().resetBonus(); @@ -169,7 +188,7 @@ public class PacketSender { player.getItemAssistant().addSpecialBar(player.playerEquipment[player.playerWeapon]); player.saveTimer = GameConstants.SAVE_TIMER; player.saveCharacter = true; - Misc.println("[REGISTERED]: " + player.playerName + ""); + Misc.println((player.isBot ? "[BOT-REGISTERED]" : "[REGISTERED]") + ": " + player.playerName + " (level-" + player.calculateCombatLevel() + ")"); player.handler.updatePlayer(player, player.outStream); player.handler.updateNPC(player, player.outStream); player.flushOutStream(); @@ -304,8 +323,12 @@ public class PacketSender { return this; } - public PacketSender sendString(String s, int id) { //Seems to be about chat messsages - if(!player.checkPacket126Update(s, id)) { + public PacketSender sendString(String s, int id) { // Update string in interfaces etc + return sendString(s, id, false); + } + + public PacketSender sendString(String s, int id, boolean forceSend) { // Update string in interfaces etc + if(!forceSend && !player.checkPacket126Update(s, id)) { return this; } if (player.getOutStream() != null && player != null) { @@ -503,8 +526,6 @@ public class PacketSender { if (player.getOutStream() != null && player != null) { if (world != 0) { world += 9; - } else if (!GameConstants.WORLD_LIST_FIX) { - world += 1; } player.getOutStream().createFrame(50); player.getOutStream().writeQWord(playerName); @@ -621,11 +642,9 @@ public class PacketSender { player.getItemAssistant().rearrangeBank(); player.getItemAssistant().resetBank(); player.getItemAssistant().resetTempItems(); - player.getOutStream().createFrame(248); - player.getOutStream().writeWordA(5292); - player.lastMainFrameInterface = MainFrameIDs.BANK; //Setting it to 5292, since I *think* that's what interface got opened - player.getOutStream().writeWord(5063); + sendFrame248(5292, 5063); player.flushOutStream(); + player.getPacketSender().sendString("The Bank of " + GameConstants.SERVER_NAME, 5383, true); player.isBanking = true; } return this; @@ -1172,15 +1191,7 @@ public class PacketSender { if (player.heightLevel != height) { return this; } - player.getOutStream().createFrame(85); - player.getOutStream().writeByteC(itemY - 8 * player.mapRegionY); - player.getOutStream().writeByteC(itemX - 8 * player.mapRegionX); - player.getOutStream().createFrame(44); - player.getOutStream().writeWordBigEndianA(itemID); - player.getOutStream().writeWord(itemAmount); - player.getOutStream().writeByte(0); - player.flushOutStream(); - return this; + return createGroundItem(itemID, itemX, itemY, itemAmount); } diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Bank10.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Bank10.java index 0428f969..6d9d3fe6 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Bank10.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Bank10.java @@ -5,6 +5,7 @@ import com.rs2.game.content.random.PartyRoom; import com.rs2.game.content.skills.crafting.JewelryMaking; import com.rs2.game.players.Player; import com.rs2.net.packets.PacketType; +import com.rs2.world.Boundary; /** * Bank 10 Items @@ -19,6 +20,13 @@ public class Bank10 implements PacketType { player.endCurrentTask(); switch (interfaceId) { + case 2274: + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { + PartyRoom.withdrawItem(player, removeSlot, 10); + return; + } + break; + case 4233: case 4239: case 4245: @@ -49,7 +57,7 @@ public class Bank10 implements PacketType { if(!player.getItemAssistant().playerHasItem(removeId)) { return; } - if (player.inPartyRoom) { + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { PartyRoom.depositItem(player, removeId, 10); break; } diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Bank5.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Bank5.java index 465f73c5..7851631b 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Bank5.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Bank5.java @@ -5,6 +5,7 @@ import com.rs2.game.content.random.PartyRoom; import com.rs2.game.content.skills.crafting.JewelryMaking; import com.rs2.game.players.Player; import com.rs2.net.packets.PacketType; +import com.rs2.world.Boundary; /** * Bank 5 Items @@ -19,6 +20,12 @@ public class Bank5 implements PacketType { player.endCurrentTask(); switch (interfaceId) { + case 2274: + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { + PartyRoom.withdrawItem(player, removeSlot, 5); + return; + } + break; case 4233: case 4239: case 4245: @@ -50,7 +57,7 @@ public class Bank5 implements PacketType { if(!player.getItemAssistant().playerHasItem(removeId)) { return; } - if (player.inPartyRoom) { + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { PartyRoom.depositItem(player, removeId, 5); break; } diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/BankAll.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/BankAll.java index 8f7737b7..b13c4a6a 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/BankAll.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/BankAll.java @@ -5,6 +5,7 @@ import com.rs2.game.items.GameItem; import com.rs2.game.items.ItemData; import com.rs2.game.players.Player; import com.rs2.net.packets.PacketType; +import com.rs2.world.Boundary; /** * Bank All Items @@ -18,6 +19,12 @@ public class BankAll implements PacketType { int removeId = player.getInStream().readUnsignedWordA(); player.endCurrentTask(); switch (interfaceId) { + case 2274: + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { + PartyRoom.withdrawItem(player, removeSlot, player.partyN[removeSlot]); + return; + } + break; // buy x case 3900: player.outStream.createFrame(27); @@ -51,7 +58,7 @@ public class BankAll implements PacketType { if(!player.getItemAssistant().playerHasItem(removeId)) { return; } - if (player.inPartyRoom) { + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { PartyRoom.depositItem(player, removeId, player.getItemAssistant().itemAmount(player.playerItems[removeSlot])); break; } diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickItem.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickItem.java index e424f662..cd8062b3 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickItem.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickItem.java @@ -76,21 +76,21 @@ public class ClickItem implements PacketType { return; } switch (itemId) { + case 4251: + player.getPlayerAssistant().movePlayer(3661, 3526, 0); + player.getItemAssistant().replaceItem(4251, 4252); + break; case 4079: player.startAnimation(1457); break; case 407: - if (Misc.random(1) == 0) { - player.getItemAssistant().addItem(409, 1); - player.getItemAssistant().deleteItem(407, 1); + int rand = Misc.random(1, 5); + if (rand <= 2) { + player.getItemAssistant().replaceItem(407, 409); + } else if (rand <= 4) { + player.getItemAssistant().replaceItem(407, 411); } else { - if (Misc.random(1) == 0) { - player.getItemAssistant().addItem(411, 1); - player.getItemAssistant().deleteItem(409, 1); - } else if (Misc.random(1) == 1) { - player.getItemAssistant().addItem(413, 1); - player.getItemAssistant().deleteItem(407, 1); - } + player.getItemAssistant().replaceItem(407, 413); } break; diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Commands.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Commands.java index 30a23721..df88b7e8 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Commands.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Commands.java @@ -481,6 +481,15 @@ public class Commands implements PacketType { player.getPacketSender().sendMessage("Player Must Be Offline."); } break; + case "mem": + Runtime runtime = Runtime.getRuntime(); + int totalMemK = (int) (runtime.totalMemory() / 1024L); + int freeMemK = (int) (runtime.freeMemory() / 1024L); + int usedMemK = (int) totalMemK - freeMemK; + player.getPacketSender().sendMessage("Total memory: " + (totalMemK / 1024) + "MB"); + player.getPacketSender().sendMessage("Used memory: " + (usedMemK / 1024) + "MB"); + player.getPacketSender().sendMessage("Free memory: " + (freeMemK / 1024) + "MB"); + break; case "update": try { if (arguments.length == 0) { @@ -574,9 +583,24 @@ public class Commands implements PacketType { if (arguments.length == 0) { player.getPacketSender().sendMessage("You must specify an id: ::interface id"); return; + } else if (arguments.length == 1) { + int interface1 = Integer.parseInt(arguments[0]); + player.getPacketSender().showInterface(interface1); + return; + } else if (arguments.length == 2) { + int interface1 = Integer.parseInt(arguments[0]); + int interface2 = Integer.parseInt(arguments[1]); + player.getPacketSender().sendFrame248(interface1, interface2); + return; + } else if (arguments.length == 2) { + int interface1 = Integer.parseInt(arguments[0]); + int interface2 = Integer.parseInt(arguments[1]); + int interface3 = Integer.parseInt(arguments[2]); + player.getPacketSender().sendFrame246(interface1, interface2, interface3); + return; + } else { + player.getPacketSender().sendMessage("Too many IDs specified, maximum of 3"); } - int interfaceID = Integer.parseInt(arguments[0]); - player.getPacketSender().showInterface(interfaceID); break; case "gfx": if (arguments.length == 0) { @@ -616,7 +640,6 @@ public class Commands implements PacketType { case "bank": player.getPacketSender().openUpBank(); break; - case "xteletome": case "teletome": try { if (arguments.length == 0) { @@ -637,7 +660,6 @@ public class Commands implements PacketType { player.getPacketSender().sendMessage("Player is not online."); } break; - case "xteleto": case "teleto": if (arguments.length == 0) { player.getPacketSender().sendMessage("You must specify a player name: ::teleto playername"); diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/InterfaceX.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/InterfaceX.java index a4a84a64..bbfbd8dd 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/InterfaceX.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/InterfaceX.java @@ -5,6 +5,7 @@ import com.rs2.game.content.skills.cooking.Cooking; import com.rs2.game.content.skills.smithing.Smelting; import com.rs2.game.players.Player; import com.rs2.net.packets.PacketType; +import com.rs2.world.Boundary; public class InterfaceX implements PacketType { @@ -27,15 +28,21 @@ public class InterfaceX implements PacketType { } } switch (player.xInterfaceId) { - case 5064: - if (player.inPartyRoom) { - PartyRoom.depositItem(player, player.xRemoveId, player.getItemAssistant().itemAmount(player.playerItems[player.xRemoveSlot])); - break; + case 2274: + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { + PartyRoom.withdrawItem(player, player.xRemoveSlot, Xamount); + return; } + break; + case 5064: if (player.inTrade) { player.getPacketSender().sendMessage("You can't store items while trading!"); return; } + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { + PartyRoom.depositItem(player, player.xRemoveId, Xamount); + return; + } player.getItemAssistant().bankItem(player.playerItems[player.xRemoveSlot], player.xRemoveSlot, Xamount); break; diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ItemOnObject.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ItemOnObject.java index e552fdfb..486c130b 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ItemOnObject.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ItemOnObject.java @@ -7,6 +7,7 @@ import com.rs2.game.content.skills.cooking.CookingTutorialIsland; import com.rs2.game.content.skills.crafting.JewelryMaking; import com.rs2.game.content.skills.crafting.Pottery; import com.rs2.game.content.skills.crafting.Spinning; +import com.rs2.game.content.skills.prayer.Ectofuntus; import com.rs2.game.items.UseItem; import com.rs2.game.items.impl.Fillables; import com.rs2.game.players.Player; @@ -28,10 +29,19 @@ public class ItemOnObject implements PacketType { player.objectX = objectX; player.objectY = objectY; player.endCurrentTask(); + int distance = 3; + switch (objectId) { + case Ectofuntus.ECTOFUNTUS: + distance = 5; + break; + default: + distance = 3; + break; + } if (!player.getItemAssistant().playerHasItem(itemId, 1)) { return; } - if (!player.goodDistance(player.objectX, player.objectY, player.absX, player.absY, 3)) { + if (!player.goodDistance(player.objectX, player.objectY, player.absX, player.absY, distance)) { return; } if (player.playerRights == 3) { diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/PrivateMessaging.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/PrivateMessaging.java index 961a9fd7..e6be52a4 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/PrivateMessaging.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/PrivateMessaging.java @@ -1,6 +1,7 @@ package com.rs2.net.packets.impl; import com.rs2.Connection; +import com.rs2.GameConstants; import com.rs2.game.players.Client; import com.rs2.game.players.Player; import com.rs2.game.players.PlayerHandler; @@ -41,7 +42,7 @@ public class PrivateMessaging implements PacketType { Client o = (Client) PlayerHandler.players[i2]; if (o != null) { if (PlayerHandler.players[i2].privateChat == 0 || PlayerHandler.players[i2].privateChat == 1 && o.getPlayerAssistant().isInPM(Misc.playerNameToInt64(player.playerName))) { - player.getPacketSender().loadPM(friendToAdd, 1); + player.getPacketSender().loadPM(friendToAdd, GameConstants.WORLD); break; } } @@ -134,7 +135,7 @@ public class PrivateMessaging implements PacketType { && PlayerHandler.players[i1].isActive) { Client o = (Client) PlayerHandler.players[i1]; if (o != null) { - o.getPlayerAssistant().updatePM(player.playerId, 1); + o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD); } } } diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/RemoveItem.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/RemoveItem.java index 6f7307e2..106fae90 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/RemoveItem.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/RemoveItem.java @@ -7,6 +7,7 @@ import com.rs2.game.items.Weight; import com.rs2.game.items.impl.RareProtection; import com.rs2.game.players.Player; import com.rs2.net.packets.PacketType; +import com.rs2.world.Boundary; /** * Remove Item @@ -28,6 +29,13 @@ public class RemoveItem implements PacketType { switch (interfaceId) { + case 2274: + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { + PartyRoom.withdrawItem(player, removeSlot, 1); + return; + } + break; + case 4233: case 4239: case 4245: @@ -48,7 +56,7 @@ public class RemoveItem implements PacketType { break; case 5064: - if (player.inPartyRoom) { + if (Boundary.isIn(player, Boundary.PARTY_ROOM)) { PartyRoom.depositItem(player, removeId, 1); } else { player.getItemAssistant().bankItem(removeId, removeSlot, 1); diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ReportHandler.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ReportHandler.java index 01d1bbe5..3c46bc94 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ReportHandler.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ReportHandler.java @@ -133,9 +133,8 @@ public class ReportHandler { .format(new Date())); String day = new SimpleDateFormat("dd").format(new Date()); bw = new BufferedWriter(new FileWriter( - "data/Reportabuses/" - + file + " month;" + month + " day;" + day - + " ms-id;" + time + ".txt", true)); + "data/logs/reports/" + + file + ".txt", true)); bw.write(data); bw.newLine(); bw.write(text); diff --git a/2006Scape Server/src/main/java/com/rs2/world/Boundary.java b/2006Scape Server/src/main/java/com/rs2/world/Boundary.java index 2cb964dd..28595b26 100644 --- a/2006Scape Server/src/main/java/com/rs2/world/Boundary.java +++ b/2006Scape Server/src/main/java/com/rs2/world/Boundary.java @@ -14,7 +14,7 @@ import com.rs2.game.players.PlayerHandler; public class Boundary { - int minX, minY, highX, highY; + int minX, highX, minY, highY; int height; /** @@ -29,11 +29,11 @@ public class Boundary { * The north-east y coordinate */ public Boundary(int minX, int highX, int minY, int highY) { - this.minX = minX; - this.minY = minY; - this.highX = highX; - this.highY = highY; - height = -1; + this.minX = Math.min(minX, highX); + this.highX = Math.max(minX, highX); + this.minY = Math.min(minY, highY); + this.highY = Math.max(minY, highY); + this.height = -1; } /** @@ -50,10 +50,10 @@ public class Boundary { * The height of the boundary */ public Boundary(int minX, int highX, int minY, int highY, int height) { - this.minX = minX; - this.minY = minY; - this.highX = highX; - this.highY = highY; + this.minX = Math.min(minX, highX); + this.highX = Math.max(minX, highX); + this.minY = Math.min(minY, highY); + this.highY = Math.max(minY, highY); this.height = height; } @@ -96,6 +96,20 @@ public class Boundary { return player.getX() >= boundaries.minX && player.getX() <= boundaries.highX && player.getY() >= boundaries.minY && player.getY() <= boundaries.highY; } + /** + * + * @param x + * The x position + * @param y + * The y position + * @param boundaries + * The boundary object + * @return + */ + public static boolean isIn(int x, int y, Boundary boundaries) { + return x >= boundaries.minX && x <= boundaries.highX && y >= boundaries.minY && y <= boundaries.highY; + } + /** * * @param npc @@ -287,5 +301,7 @@ public class Boundary { public static final Boundary FIGHT_CAVES = new Boundary(2360, 2445, 5045, 5125); public static final Boundary PIRATE_HOUSE = new Boundary(3038, 3044, 3949, 3959); public static final Boundary[] FIGHT_PITS = new Boundary[] { new Boundary(2378, 3415, 5133, 5167), new Boundary(2394, 2404, 5169, 5174) }; + public static final Boundary PARTY_ROOM = new Boundary(2727, 2746, 3460, 3479); + public static final Boundary PARTY_ROOM_TABLE = new Boundary(2735, 2740, 3467, 3468); } \ No newline at end of file diff --git a/2006Scape Server/src/main/java/com/rs2/world/ItemHandler.java b/2006Scape Server/src/main/java/com/rs2/world/ItemHandler.java index a825727c..e63fec88 100644 --- a/2006Scape Server/src/main/java/com/rs2/world/ItemHandler.java +++ b/2006Scape Server/src/main/java/com/rs2/world/ItemHandler.java @@ -165,7 +165,7 @@ public class ItemHandler { c.getPacketSender().sendMessage("The cape vanishes as it touches the ground."); return; } - if (itemId > 4705 && itemId < 4760) { + if (itemId >= 4708 && itemId <= 4759) { for (int[] brokenBarrow : brokenBarrows) { if (brokenBarrow[0] == itemId) { itemId = brokenBarrow[1];