diff --git a/Elvarg - Client/Cache/jingle1.mid b/Elvarg - Client/Cache/jingle1.mid new file mode 100644 index 0000000..a7b9cf2 Binary files /dev/null and b/Elvarg - Client/Cache/jingle1.mid differ diff --git a/Elvarg - Client/Cache/jingle2.mid b/Elvarg - Client/Cache/jingle2.mid new file mode 100644 index 0000000..a7b9cf2 Binary files /dev/null and b/Elvarg - Client/Cache/jingle2.mid differ diff --git a/Elvarg - Client/Cache/main_file_cache.dat b/Elvarg - Client/Cache/main_file_cache.dat new file mode 100644 index 0000000..39abb99 Binary files /dev/null and b/Elvarg - Client/Cache/main_file_cache.dat differ diff --git a/Elvarg - Client/Cache/main_file_cache.idx0 b/Elvarg - Client/Cache/main_file_cache.idx0 new file mode 100644 index 0000000..17bece0 Binary files /dev/null and b/Elvarg - Client/Cache/main_file_cache.idx0 differ diff --git a/Elvarg - Client/Cache/main_file_cache.idx1 b/Elvarg - Client/Cache/main_file_cache.idx1 new file mode 100644 index 0000000..a3462ff Binary files /dev/null and b/Elvarg - Client/Cache/main_file_cache.idx1 differ diff --git a/Elvarg - Client/Cache/main_file_cache.idx2 b/Elvarg - Client/Cache/main_file_cache.idx2 new file mode 100644 index 0000000..1af9301 Binary files /dev/null and b/Elvarg - Client/Cache/main_file_cache.idx2 differ diff --git a/Elvarg - Client/Cache/main_file_cache.idx3 b/Elvarg - Client/Cache/main_file_cache.idx3 new file mode 100644 index 0000000..b2aef72 Binary files /dev/null and b/Elvarg - Client/Cache/main_file_cache.idx3 differ diff --git a/Elvarg - Client/Cache/main_file_cache.idx4 b/Elvarg - Client/Cache/main_file_cache.idx4 new file mode 100644 index 0000000..bb13a7f Binary files /dev/null and b/Elvarg - Client/Cache/main_file_cache.idx4 differ diff --git a/Elvarg - Client/Cache/obj.dat b/Elvarg - Client/Cache/obj.dat new file mode 100644 index 0000000..f65bbc6 Binary files /dev/null and b/Elvarg - Client/Cache/obj.dat differ diff --git a/Elvarg - Client/Cache/obj.idx b/Elvarg - Client/Cache/obj.idx new file mode 100644 index 0000000..6bba7a9 Binary files /dev/null and b/Elvarg - Client/Cache/obj.idx differ diff --git a/Elvarg - Client/Cache/sprites.dat b/Elvarg - Client/Cache/sprites.dat new file mode 100644 index 0000000..33723aa Binary files /dev/null and b/Elvarg - Client/Cache/sprites.dat differ diff --git a/Elvarg - Client/Cache/sprites.idx b/Elvarg - Client/Cache/sprites.idx new file mode 100644 index 0000000..c9c7ca9 Binary files /dev/null and b/Elvarg - Client/Cache/sprites.idx differ diff --git a/Elvarg - Client/src/com/runescape/Client.java b/Elvarg - Client/src/com/runescape/Client.java index 709e576..e80a7b1 100644 --- a/Elvarg - Client/src/com/runescape/Client.java +++ b/Elvarg - Client/src/com/runescape/Client.java @@ -14,7 +14,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import java.net.InetAddress; import java.net.Socket; import java.net.URL; @@ -32,7 +31,6 @@ import javax.imageio.ImageIO; import org.seven.cache.graphics.RSFont; -import org.seven.scene.graphic.Fog; import org.seven.util.CacheUtils; import com.runescape.cache.FileArchive; @@ -160,20 +158,18 @@ public enum ScreenMode { FIXED, RESIZABLE, FULLSCREEN; } - private Fog fog = new Fog(); - private int[][] xp_added = new int[10][3]; private Sprite[] skill_sprites = new Sprite[SkillConstants.SKILL_COUNT]; private Sprite hp; - //Timers + // Timers public List effects_list = new CopyOnWriteArrayList(); public void addEffectTimer(EffectTimer et) { - //Check if exists.. If so, update delay. - for(EffectTimer timer : effects_list) { - if(timer.getSprite() == et.getSprite()) { + // Check if exists.. If so, update delay. + for (EffectTimer timer : effects_list) { + if (timer.getSprite() == et.getSprite()) { timer.setTimer(et.getTimer()); return; } @@ -182,26 +178,6 @@ public void addEffectTimer(EffectTimer et) { effects_list.add(et); } - public void drawEffectTimers() { - int yDraw = frameHeight - 195; - int xDraw = frameWidth - 330; - for(EffectTimer timer : effects_list) { - if(timer.decrementAndGetTimer() <= 0) { - effects_list.remove(timer); - continue; - } - - Sprite sprite = cacheSprite[timer.getSprite()]; - - if(sprite != null) { - sprite.drawAdvancedSprite(xDraw + 12, yDraw); - newSmallFont.drawBasicString(calculateInMinutes(timer.getTimer()) + "", xDraw + 40, yDraw + 13, 0xFF8C00); - yDraw-= 25; - } - } - } - - private String calculateInMinutes(int paramInt) { int i = (int) Math.floor(paramInt / 60); int j = paramInt - i * 60; @@ -216,7 +192,6 @@ private String calculateInMinutes(int paramInt) { return str1 + ":" + str2; } - public static ScreenMode frameMode = ScreenMode.FIXED; public static int frameWidth = 765; public static int frameHeight = 503; @@ -233,10 +208,11 @@ private String calculateInMinutes(int paramInt) { private final NumberFormat format = NumberFormat.getInstance(Locale.US); /** - * CRC32 is one of hash functions based on on the "polynomial" division idea. The CRC is - * acronym for Cyclic Redundancy Code (other variants instead "Code" is "Check" and - * "Checksum") algorithm. The number 32 is specifying the size of resulting hash value - * (checksum The value calculated from content of file. + * CRC32 is one of hash functions based on on the "polynomial" division + * idea. The CRC is acronym for Cyclic Redundancy Code (other variants + * instead "Code" is "Check" and "Checksum") algorithm. The number 32 is + * specifying the size of resulting hash value (checksum The value + * calculated from content of file. */ public CRC32 indexCrc = new CRC32(); @@ -269,22 +245,22 @@ public static void frameMode(ScreenMode screenMode) { } private void addToXPCounter(int skill, int xp) { - int font_height = 24; - if (xp <= 0) + if (xp <= 0) { return; - + } + int font_height = 24; xpCounter += xp; - int lowest_y_off = Integer.MAX_VALUE; - for (int i = 0; i < xp_added.length; i++) - if (xp_added[i][0] > -1) + for (int i = 0; i < xp_added.length; i++) { + if (xp_added[i][0] > -1) { lowest_y_off = Math.min(lowest_y_off, xp_added[i][2]); - + } + } if (Configuration.xp_merge && lowest_y_off != Integer.MAX_VALUE && lowest_y_off <= 0) { for (int i = 0; i < xp_added.length; i++) { - if (xp_added[i][2] != lowest_y_off) + if (xp_added[i][2] != lowest_y_off) { continue; - + } xp_added[i][0] |= (1 << skill); xp_added[i][1] += xp; return; @@ -292,15 +268,12 @@ private void addToXPCounter(int skill, int xp) { } else { ArrayList list = new ArrayList(); int y = font_height; - boolean go_on = true; while (go_on) { go_on = false; - for (int i = 0; i < xp_added.length; i++) { if (xp_added[i][0] == -1 || list.contains(new Integer(i))) continue; - if (xp_added[i][2] < y) { xp_added[i][2] = y; y += font_height; @@ -309,32 +282,30 @@ private void addToXPCounter(int skill, int xp) { } } } - - if (lowest_y_off == Integer.MAX_VALUE || lowest_y_off >= font_height) + if (lowest_y_off == Integer.MAX_VALUE || lowest_y_off >= font_height) { lowest_y_off = 0; - else + } else { lowest_y_off = 0; - - for (int i = 0; i < xp_added.length; i++) + } + for (int i = 0; i < xp_added.length; i++) { if (xp_added[i][0] == -1) { xp_added[i][0] = (1 << skill); xp_added[i][1] = xp; xp_added[i][2] = lowest_y_off; return; } + } } } - public static void rebuildFrameSize(ScreenMode screenMode, int screenWidth, - int screenHeight) { + public static void rebuildFrameSize(ScreenMode screenMode, int screenWidth, int screenHeight) { try { screenAreaWidth = (screenMode == ScreenMode.FIXED) ? 512 : screenWidth; screenAreaHeight = (screenMode == ScreenMode.FIXED) ? 334 : screenHeight; frameWidth = screenWidth; frameHeight = screenHeight; - instance.refreshFrameSize(screenMode == ScreenMode.FULLSCREEN, screenWidth, - screenHeight, screenMode == ScreenMode.RESIZABLE, - screenMode != ScreenMode.FIXED); + instance.refreshFrameSize(screenMode == ScreenMode.FULLSCREEN, screenWidth, screenHeight, + screenMode == ScreenMode.RESIZABLE, screenMode != ScreenMode.FIXED); setBounds(); } catch (Exception e) { e.printStackTrace(); @@ -343,17 +314,13 @@ public static void rebuildFrameSize(ScreenMode screenMode, int screenWidth, public void refreshFrameSize() { if (frameMode == ScreenMode.RESIZABLE) { - if (frameWidth != (appletClient() ? getGameComponent().getWidth() - : gameFrame.getFrameWidth())) { - frameWidth = (appletClient() ? getGameComponent().getWidth() - : gameFrame.getFrameWidth()); + if (frameWidth != (appletClient() ? getGameComponent().getWidth() : gameFrame.getFrameWidth())) { + frameWidth = (appletClient() ? getGameComponent().getWidth() : gameFrame.getFrameWidth()); screenAreaWidth = frameWidth; setBounds(); } - if (frameHeight != (appletClient() ? getGameComponent().getHeight() - : gameFrame.getFrameHeight())) { - frameHeight = (appletClient() ? getGameComponent().getHeight() - : gameFrame.getFrameHeight()); + if (frameHeight != (appletClient() ? getGameComponent().getHeight() : gameFrame.getFrameHeight())) { + frameHeight = (appletClient() ? getGameComponent().getHeight() : gameFrame.getFrameHeight()); screenAreaHeight = frameHeight; setBounds(); } @@ -364,22 +331,16 @@ private static void setBounds() { Rasterizer3D.reposition(frameWidth, frameHeight); fullScreenTextureArray = Rasterizer3D.scanOffsets; Rasterizer3D.reposition( - frameMode == ScreenMode.FIXED - ? (chatboxImageProducer != null - ? chatboxImageProducer.canvasWidth : 519) + frameMode == ScreenMode.FIXED ? (chatboxImageProducer != null ? chatboxImageProducer.canvasWidth : 519) : frameWidth, - frameMode == ScreenMode.FIXED - ? (chatboxImageProducer != null - ? chatboxImageProducer.canvasHeight : 165) - : frameHeight); + frameMode == ScreenMode.FIXED ? (chatboxImageProducer != null ? chatboxImageProducer.canvasHeight : 165) + : frameHeight); anIntArray1180 = Rasterizer3D.scanOffsets; Rasterizer3D.reposition( - frameMode == ScreenMode.FIXED - ? (tabImageProducer != null ? tabImageProducer.canvasWidth - : 249) + frameMode == ScreenMode.FIXED ? (tabImageProducer != null ? tabImageProducer.canvasWidth : 249) : frameWidth, - frameMode == ScreenMode.FIXED ? (tabImageProducer != null - ? tabImageProducer.canvasHeight : 335) : frameHeight); + frameMode == ScreenMode.FIXED ? (tabImageProducer != null ? tabImageProducer.canvasHeight : 335) + : frameHeight); anIntArray1181 = Rasterizer3D.scanOffsets; Rasterizer3D.reposition(screenAreaWidth, screenAreaHeight); anIntArray1182 = Rasterizer3D.scanOffsets; @@ -390,8 +351,8 @@ private static void setBounds() { int i9 = Rasterizer3D.anIntArray1470[k8]; ai[i8] = l8 * i9 >> 16; } - if (frameMode == ScreenMode.RESIZABLE && (frameWidth >= 766) && (frameWidth <= 1025) - && (frameHeight >= 504) && (frameHeight <= 850)) { + if (frameMode == ScreenMode.RESIZABLE && (frameWidth >= 766) && (frameWidth <= 1025) && (frameHeight >= 504) + && (frameHeight <= 850)) { SceneGraph.viewDistance = 9; cameraZoom = 575; } else if (frameMode == ScreenMode.FIXED) { @@ -402,32 +363,28 @@ private static void setBounds() { } SceneGraph.setupViewport(500, 800, screenAreaWidth, screenAreaHeight, ai); if (loggedIn) { - gameScreenImageProducer = - new ProducingGraphicsBuffer(screenAreaWidth, screenAreaHeight); + gameScreenImageProducer = new ProducingGraphicsBuffer(screenAreaWidth, screenAreaHeight); } } public boolean getMousePositions() { - if (mouseInRegion(frameWidth - (frameWidth <= 1000 ? 240 : 420), - frameHeight - (frameWidth <= 1000 ? 90 : 37), frameWidth, frameHeight)) { + if (mouseInRegion(frameWidth - (frameWidth <= 1000 ? 240 : 420), frameHeight - (frameWidth <= 1000 ? 90 : 37), + frameWidth, frameHeight)) { return false; } if (showChatComponents) { if (changeChatArea) { - if (super.mouseX > 0 && super.mouseX < 494 - && super.mouseY > frameHeight - 175 + if (super.mouseX > 0 && super.mouseX < 494 && super.mouseY > frameHeight - 175 && super.mouseY < frameHeight) { return true; } else { - if (super.mouseX > 494 && super.mouseX < 515 - && super.mouseY > frameHeight - 175 + if (super.mouseX > 494 && super.mouseX < 515 && super.mouseY > frameHeight - 175 && super.mouseY < frameHeight) { return false; } } } else if (!changeChatArea) { - if (super.mouseX > 0 && super.mouseX < 519 - && super.mouseY > frameHeight - 175 + if (super.mouseX > 0 && super.mouseX < 519 && super.mouseY > frameHeight - 175 && super.mouseY < frameHeight) { return false; } @@ -437,8 +394,7 @@ public boolean getMousePositions() { return false; } if (!changeTabArea) { - if (super.mouseX > 0 && super.mouseY > 0 && super.mouseY < frameWidth - && super.mouseY < frameHeight) { + if (super.mouseX > 0 && super.mouseY > 0 && super.mouseY < frameWidth && super.mouseY < frameHeight) { if (super.mouseX >= frameWidth - 242 && super.mouseY >= frameHeight - 335) { return false; } @@ -448,21 +404,17 @@ public boolean getMousePositions() { } if (showTabComponents) { if (frameWidth > 1000) { - if (super.mouseX >= frameWidth - 420 && super.mouseX <= frameWidth - && super.mouseY >= frameHeight - 37 + if (super.mouseX >= frameWidth - 420 && super.mouseX <= frameWidth && super.mouseY >= frameHeight - 37 && super.mouseY <= frameHeight || super.mouseX > frameWidth - 225 && super.mouseX < frameWidth - && super.mouseY > frameHeight - 37 - 274 - && super.mouseY < frameHeight) { + && super.mouseY > frameHeight - 37 - 274 && super.mouseY < frameHeight) { return false; } } else { - if (super.mouseX >= frameWidth - 210 && super.mouseX <= frameWidth - && super.mouseY >= frameHeight - 74 + if (super.mouseX >= frameWidth - 210 && super.mouseX <= frameWidth && super.mouseY >= frameHeight - 74 && super.mouseY <= frameHeight || super.mouseX > frameWidth - 225 && super.mouseX < frameWidth - && super.mouseY > frameHeight - 74 - 274 - && super.mouseY < frameHeight) { + && super.mouseY > frameHeight - 74 - 274 && super.mouseY < frameHeight) { return false; } } @@ -471,16 +423,14 @@ public boolean getMousePositions() { } public boolean mouseInRegion(int x1, int y1, int x2, int y2) { - if (super.mouseX >= x1 && super.mouseX <= x2 && super.mouseY >= y1 - && super.mouseY <= y2) { + if (super.mouseX >= x1 && super.mouseX <= x2 && super.mouseY >= y1 && super.mouseY <= y2) { return true; } return false; } public boolean mouseMapPosition() { - if (super.mouseX >= frameWidth - 21 && super.mouseX <= frameWidth && super.mouseY >= 0 - && super.mouseY <= 21) { + if (super.mouseX >= frameWidth - 21 && super.mouseX <= frameWidth && super.mouseY >= 0 && super.mouseY <= 21) { return false; } return true; @@ -500,7 +450,6 @@ private void drawLoadingMessages(int used, String s, String s1) { } } - private static final long serialVersionUID = 5707517957054703648L; private static String intToKOrMilLongName(int i) { @@ -539,8 +488,7 @@ public static final byte[] ReadFile(String fileName) { datainputstream.close(); return abyte0; } catch (Exception e) { - System.out.println((new StringBuilder()).append("Read Error: ").append(fileName) - .toString()); + System.out.println((new StringBuilder()).append("Read Error: ").append(fileName).toString()); return null; } } @@ -554,19 +502,16 @@ private boolean menuHasAddFriend(int j) { return k == 337; } - private final int[] modeX = {164, 230, 296, 362}, - modeNamesX = {26, 86, 150, 212, 286, 349, 427}, - modeNamesY = {158, 158, 153, 153, 153, 153, 158}, - channelButtonsX = {5, 71, 137, 203, 269, 335, 404}; + private final int[] modeX = { 164, 230, 296, 362 }, modeNamesX = { 26, 86, 150, 212, 286, 349, 427 }, + modeNamesY = { 158, 158, 153, 153, 153, 153, 158 }, channelButtonsX = { 5, 71, 137, 203, 269, 335, 404 }; - private final String[] modeNames = - {"All", "Game", "Public", "Private", "Clan", "Trade", "Report Abuse"}; + private final String[] modeNames = { "All", "Game", "Public", "Private", "Clan", "Trade", "Report Abuse" }; public void drawChannelButtons() { final int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 165; cacheSprite[49].drawSprite(0, 143 + yOffset); - String text[] = {"On", "Friends", "Off", "Hide"}; - int textColor[] = {65280, 0xffff00, 0xff0000, 65535}; + String text[] = { "On", "Friends", "Off", "Hide" }; + int textColor[] = { 65280, 0xffff00, 0xff0000, 65535 }; switch (cButtonCPos) { case 0: case 1: @@ -588,8 +533,7 @@ public void drawChannelButtons() { case 5: case 6: case 7: - cacheSprite[17].drawSprite(channelButtonsX[cButtonHPos], - 143 + yOffset); + cacheSprite[17].drawSprite(channelButtonsX[cButtonHPos], 143 + yOffset); break; } } else { @@ -600,29 +544,25 @@ public void drawChannelButtons() { case 3: case 4: case 5: - cacheSprite[15].drawSprite(channelButtonsX[cButtonHPos], - 143 + yOffset); + cacheSprite[15].drawSprite(channelButtonsX[cButtonHPos], 143 + yOffset); break; case 6: - cacheSprite[18].drawSprite(channelButtonsX[cButtonHPos], - 143 + yOffset); + cacheSprite[18].drawSprite(channelButtonsX[cButtonHPos], 143 + yOffset); break; } } - int[] modes = {publicChatMode, privateChatMode, clanChatMode, tradeMode}; + int[] modes = { publicChatMode, privateChatMode, clanChatMode, tradeMode }; for (int i = 0; i < modeNamesX.length; i++) { - smallText.drawTextWithPotentialShadow(true, modeNamesX[i], 0xffffff, modeNames[i], - modeNamesY[i] + yOffset); + smallText.drawTextWithPotentialShadow(true, modeNamesX[i], 0xffffff, modeNames[i], modeNamesY[i] + yOffset); } for (int i = 0; i < modeX.length; i++) { - smallText.method382(textColor[modes[i]], modeX[i], text[modes[i]], 164 + yOffset, - true); + smallText.method382(textColor[modes[i]], modeX[i], text[modes[i]], 164 + yOffset, true); } } private boolean chatStateCheck() { - return messagePromptRaised || inputDialogState != 0 || clickToContinueString != null - || backDialogueId != -1 || dialogueId != -1; + return messagePromptRaised || inputDialogState != 0 || clickToContinueString != null || backDialogueId != -1 + || dialogueId != -1; } private String enter_amount_title = "Enter amount:"; @@ -656,12 +596,10 @@ private void drawChatArea() { newBoldFont.drawCenteredString(promptInput + "*", 259, 80 + yOffset, 128, -1); } else if (inputDialogState == 1) { newBoldFont.drawCenteredString(enter_amount_title, 259, yOffset + 60, 0, -1); - newBoldFont.drawCenteredString(amountOrNameInput + "*", 259, 80 + yOffset, 128, - -1); + newBoldFont.drawCenteredString(amountOrNameInput + "*", 259, 80 + yOffset, 128, -1); } else if (inputDialogState == 2) { newBoldFont.drawCenteredString(enter_name_title, 259, 60 + yOffset, 0, -1); - newBoldFont.drawCenteredString(amountOrNameInput + "*", 259, 80 + yOffset, 128, - -1); + newBoldFont.drawCenteredString(amountOrNameInput + "*", 259, 80 + yOffset, 128, -1); } else if (clickToContinueString != null) { newBoldFont.drawCenteredString(clickToContinueString, 259, 60 + yOffset, 0, -1); newBoldFont.drawCenteredString("Click to continue", 259, 80 + yOffset, 128, -1); @@ -700,51 +638,41 @@ private void drawChatArea() { } if (chatType == 0) { if (chatTypeView == 5 || chatTypeView == 0) { - newRegularFont.drawBasicString(chatMessages[k], 11, - yPos + yOffset, changeChatArea ? 0xFFFFFF : 0, - shadow); + newRegularFont.drawBasicString(chatMessages[k], 11, yPos + yOffset, + changeChatArea ? 0xFFFFFF : 0, shadow); j++; j77++; } } - if ((chatType == 1 || chatType == 2) && (chatType == 1 - || publicChatMode == 0 - || publicChatMode == 1 && isFriendOrSelf(s1))) { + if ((chatType == 1 || chatType == 2) + && (chatType == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s1))) { if (chatTypeView == 1 || chatTypeView == 0) { int xPos = 11; if (data == 1) { - modIcons[0].drawSprite(xPos + 1, - yPos - 12 + yOffset); + modIcons[0].drawSprite(xPos + 1, yPos - 12 + yOffset); xPos += 14; } else if (data == 2) { - modIcons[1].drawSprite(xPos + 1, - yPos - 12 + yOffset); + modIcons[1].drawSprite(xPos + 1, yPos - 12 + yOffset); xPos += 14; } else if (data == 3) { - modIcons[2].drawSprite(xPos + 1, - yPos - 12 + yOffset); + modIcons[2].drawSprite(xPos + 1, yPos - 12 + yOffset); xPos += 14; } - newRegularFont.drawBasicString(s1 + ":", xPos, - yPos + yOffset, changeChatArea ? 0xFFFFFF : 0, - shadow); + newRegularFont.drawBasicString(s1 + ":", xPos, yPos + yOffset, + changeChatArea ? 0xFFFFFF : 0, shadow); xPos += font.getTextWidth(s1) + 8; - newRegularFont.drawBasicString(chatMessages[k], xPos, - yPos + yOffset, + newRegularFont.drawBasicString(chatMessages[k], xPos, yPos + yOffset, changeChatArea ? 0x7FA9FF : 255, shadow); j++; j77++; } } - if ((chatType == 3 || chatType == 7) - && (splitPrivateChat == 0 || chatTypeView == 2) - && (chatType == 7 || privateChatMode == 0 - || privateChatMode == 1 - && isFriendOrSelf(s1))) { + if ((chatType == 3 || chatType == 7) && (splitPrivateChat == 0 || chatTypeView == 2) + && (chatType == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s1))) { if (chatTypeView == 2 || chatTypeView == 0) { int k1 = 11; - newRegularFont.drawBasicString("From", k1, yPos + yOffset, - changeChatArea ? 0 : 0xFFFFFF, shadow); + newRegularFont.drawBasicString("From", k1, yPos + yOffset, changeChatArea ? 0 : 0xFFFFFF, + shadow); k1 += font.getTextWidth("From "); if (data == 1) { modIcons[0].drawSprite(k1, yPos - 12 + yOffset); @@ -756,65 +684,57 @@ && isFriendOrSelf(s1))) { modIcons[2].drawSprite(k1, yPos - 12 + yOffset); k1 += 12; } - newRegularFont.drawBasicString(s1 + ":", k1, - yPos + yOffset, changeChatArea ? 0xFFFFFF : 0, - shadow); + newRegularFont.drawBasicString(s1 + ":", k1, yPos + yOffset, changeChatArea ? 0xFFFFFF : 0, + shadow); k1 += font.getTextWidth(s1) + 8; - newRegularFont.drawBasicString(chatMessages[k], k1, - yPos + yOffset, 0x800080, shadow); + newRegularFont.drawBasicString(chatMessages[k], k1, yPos + yOffset, 0x800080, shadow); j++; j77++; } } - if (chatType == 4 && (tradeMode == 0 - || tradeMode == 1 && isFriendOrSelf(s1))) { + if (chatType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) { if (chatTypeView == 3 || chatTypeView == 0) { - newRegularFont.drawBasicString(s1 + " " + chatMessages[k], - 11, yPos + yOffset, 0x800080, shadow); + newRegularFont.drawBasicString(s1 + " " + chatMessages[k], 11, yPos + yOffset, 0x800080, + shadow); j++; j77++; } } if (chatType == 5 && splitPrivateChat == 0 && privateChatMode < 2) { if (chatTypeView == 2 || chatTypeView == 0) { - newRegularFont.drawBasicString(s1 + " " + chatMessages[k], - 11, yPos + yOffset, 0x800080, shadow); + newRegularFont.drawBasicString(s1 + " " + chatMessages[k], 11, yPos + yOffset, 0x800080, + shadow); j++; j77++; } } - if (chatType == 6 && (splitPrivateChat == 0 || chatTypeView == 2) - && privateChatMode < 2) { + if (chatType == 6 && (splitPrivateChat == 0 || chatTypeView == 2) && privateChatMode < 2) { if (chatTypeView == 2 || chatTypeView == 0) { - newRegularFont.drawBasicString("To " + s1 + ":", 11, - yPos + yOffset, changeChatArea ? 0xFFFFFF : 0, - shadow); - newRegularFont.drawBasicString(chatMessages[k], - 15 + font.getTextWidth("To :" + s1), + newRegularFont.drawBasicString("To " + s1 + ":", 11, yPos + yOffset, + changeChatArea ? 0xFFFFFF : 0, shadow); + newRegularFont.drawBasicString(chatMessages[k], 15 + font.getTextWidth("To :" + s1), yPos + yOffset, 0x800080, shadow); j++; j77++; } } - if (chatType == 8 && (tradeMode == 0 - || tradeMode == 1 && isFriendOrSelf(s1))) { + if (chatType == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) { if (chatTypeView == 3 || chatTypeView == 0) { - newRegularFont.drawBasicString(s1 + " " + chatMessages[k], - 11, yPos + yOffset, 0x7e3200, shadow); + newRegularFont.drawBasicString(s1 + " " + chatMessages[k], 11, yPos + yOffset, 0x7e3200, + shadow); j++; j77++; } if (chatType == 11 && (clanChatMode == 0)) { if (chatTypeView == 11) { - newRegularFont.drawBasicString( - s1 + " " + chatMessages[k], 11, - yPos + yOffset, 0x7e3200, shadow); + newRegularFont.drawBasicString(s1 + " " + chatMessages[k], 11, yPos + yOffset, 0x7e3200, + shadow); j++; j77++; } if (chatType == 12) { - newRegularFont.drawBasicString(chatMessages[k] + "", - 11, yPos + yOffset, 0x7e3200, shadow); + newRegularFont.drawBasicString(chatMessages[k] + "", 11, yPos + yOffset, 0x7e3200, + shadow); j++; } } @@ -822,8 +742,7 @@ && isFriendOrSelf(s1))) { if (chatType == 16) { if (chatTypeView == 11 || chatTypeView == 0) { - newRegularFont.drawBasicString(chatMessages[k], 10, - yPos + yOffset, 0x800080, shadow); + newRegularFont.drawBasicString(chatMessages[k], 10, yPos + yOffset, 0x800080, shadow); j++; j77++; @@ -836,8 +755,7 @@ && isFriendOrSelf(s1))) { if (anInt1211 < 111) { anInt1211 = 111; } - drawScrollbar(114, anInt1211 - anInt1089 - 113, 7 + yOffset, 496, anInt1211, - changeChatArea); + drawScrollbar(114, anInt1211 - anInt1089 - 113, 7 + yOffset, 496, anInt1211, changeChatArea); String s; if (localPlayer != null && localPlayer.name != null) { s = localPlayer.name; @@ -850,10 +768,8 @@ && isFriendOrSelf(s1))) { modIcons[myPrivilege - 1].drawSprite(10, 122 + yOffset); xOffset += 14; } - newRegularFont.drawBasicString(s + ":", xOffset + 11, 133 + yOffset, - changeChatArea ? 0xFFFFFF : 0, shadow); - newRegularFont.drawBasicString(inputString + "*", - xOffset + 12 + font.getTextWidth(s + ": "), 133 + yOffset, + newRegularFont.drawBasicString(s + ":", xOffset + 11, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, shadow); + newRegularFont.drawBasicString(inputString + "*", xOffset + 12 + font.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, shadow); Rasterizer2D.drawHorizontalLine(7, 121 + yOffset, 506, changeChatArea ? 0x575757 : 0x807660); Rasterizer2D.defaultDrawingAreaSize(); @@ -871,13 +787,11 @@ && isFriendOrSelf(s1))) { public static String capitalize(String s) { for (int i = 0; i < s.length(); i++) { if (i == 0) { - s = String.format("%s%s", Character.toUpperCase(s.charAt(0)), - s.substring(1)); + s = String.format("%s%s", Character.toUpperCase(s.charAt(0)), s.substring(1)); } if (!Character.isLetterOrDigit(s.charAt(i))) { if (i + 1 < s.length()) { - s = String.format("%s%s%s", s.subSequence(0, i + 1), - Character.toUpperCase(s.charAt(i + 1)), + s = String.format("%s%s%s", s.subSequence(0, i + 1), Character.toUpperCase(s.charAt(i + 1)), s.substring(i + 2)); } } @@ -903,6 +817,7 @@ public void initialize() { } } + @Override public void startRunnable(Runnable runnable, int priority) { if (priority > 10) priority = 10; @@ -921,8 +836,8 @@ private void processMenuClick() { if (activeInterfaceType != 0) return; int j = super.clickMode3; - if (spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 - && super.saveClickX <= 765 && super.saveClickY <= 205) + if (spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 && super.saveClickX <= 765 + && super.saveClickY <= 205) j = 0; if (menuOpen) { if (j != 1) { @@ -944,8 +859,7 @@ private void processMenuClick() { k -= 519; j1 -= 0; } - if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 - || j1 < menuOffsetY - 10 + if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10 || j1 > menuOffsetY + menuHeight + 10) { menuOpen = false; if (menuScreenArea == 1) { @@ -996,9 +910,8 @@ private void processMenuClick() { } else { if (j == 1 && menuActionRow > 0) { int i1 = menuActionTypes[menuActionRow - 1]; - if (i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53 || i1 == 74 - || i1 == 454 || i1 == 539 || i1 == 493 || i1 == 847 || i1 == 447 - || i1 == 1125) { + if (i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53 || i1 == 74 || i1 == 454 || i1 == 539 + || i1 == 493 || i1 == 847 || i1 == 447 || i1 == 1125) { int l1 = firstMenuAction[menuActionRow - 1]; int j2 = secondMenuAction[menuActionRow - 1]; Widget class9 = Widget.interfaceCache[j2]; @@ -1018,8 +931,7 @@ private void processMenuClick() { } } } - if (j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) - && menuActionRow > 2) + if (j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) j = 2; if (j == 1 && menuActionRow > 0) processMenuActions(menuActionRow - 1); @@ -1064,8 +976,8 @@ private void updateWorldObjects() { int k5 = (localRegionIds[i3] & 0xff) * 64 - regionBaseY; byte abyte0[] = localRegionMapData[i3]; if (abyte0 != null) - objectManager.method180(abyte0, k5, i4, (this.regionX - 6) * 8, - (this.regionY - 6) * 8, collisionMaps); + objectManager.method180(abyte0, k5, i4, (this.regionX - 6) * 8, (this.regionY - 6) * 8, + collisionMaps); } for (int j4 = 0; j4 < k2; j4++) { int l5 = (localRegionIds[j4] >> 8) * 64 - regionBaseX; @@ -1074,13 +986,11 @@ private void updateWorldObjects() { if (abyte2 == null && this.regionY < 800) objectManager.initiateVertexHeights(k7, 64, 64, l5); } - /* anInt1097++; - if (anInt1097 > 160) { - anInt1097 = 0; - //anticheat? - outgoing.writeOpcode(238); - outgoing.writeByte(96); - }*/ + /* + * anInt1097++; if (anInt1097 > 160) { anInt1097 = 0; + * //anticheat? outgoing.writeOpcode(238); + * outgoing.writeByte(96); } + */ sendPacket(new BasicPing()); for (int i6 = 0; i6 < k2; i6++) { byte abyte1[] = localRegionLandscapeData[i6]; @@ -1098,21 +1008,17 @@ private void updateWorldObjects() { int l7 = localRegions[j3][k4][j6]; if (l7 != -1) { int i9 = l7 >> 24 & 3; - int l9 = l7 >> 1 & 3; - int j10 = l7 >> 14 & 0x3ff; - int l10 = l7 >> 3 & 0x7ff; - int j11 = (j10 / 8 << 8) + l10 / 8; - for (int l11 = - 0; l11 < localRegionIds.length; l11++) { - if (localRegionIds[l11] != j11 - || localRegionMapData[l11] == null) - continue; - objectManager.method179(i9, l9, collisionMaps, - k4 * 8, (j10 & 7) * 8, - localRegionMapData[l11], - (l10 & 7) * 8, j3, j6 * 8); - break; - } + int l9 = l7 >> 1 & 3; + int j10 = l7 >> 14 & 0x3ff; + int l10 = l7 >> 3 & 0x7ff; + int j11 = (j10 / 8 << 8) + l10 / 8; + for (int l11 = 0; l11 < localRegionIds.length; l11++) { + if (localRegionIds[l11] != j11 || localRegionMapData[l11] == null) + continue; + objectManager.method179(i9, l9, collisionMaps, k4 * 8, (j10 & 7) * 8, + localRegionMapData[l11], (l10 & 7) * 8, j3, j6 * 8); + break; + } } } @@ -1133,22 +1039,18 @@ private void updateWorldObjects() { int i10 = localRegions[l6][j8][j9]; if (i10 != -1) { int k10 = i10 >> 24 & 3; - int i11 = i10 >> 1 & 3; - int k11 = i10 >> 14 & 0x3ff; - int i12 = i10 >> 3 & 0x7ff; - int j12 = (k11 / 8 << 8) + i12 / 8; - for (int k12 = - 0; k12 < localRegionIds.length; k12++) { - if (localRegionIds[k12] != j12 - || localRegionLandscapeData[k12] == null) { - continue; - } - objectManager.method183(collisionMaps, scene, - k10, j8 * 8, (i12 & 7) * 8, l6, - localRegionLandscapeData[k12], - (k11 & 7) * 8, i11, j9 * 8); - break; - } + int i11 = i10 >> 1 & 3; + int k11 = i10 >> 14 & 0x3ff; + int i12 = i10 >> 3 & 0x7ff; + int j12 = (k11 / 8 << 8) + i12 / 8; + for (int k12 = 0; k12 < localRegionIds.length; k12++) { + if (localRegionIds[k12] != j12 || localRegionLandscapeData[k12] == null) { + continue; + } + objectManager.method183(collisionMaps, scene, k10, j8 * 8, (i12 & 7) * 8, l6, + localRegionLandscapeData[k12], (k11 & 7) * 8, i11, j9 * 8); + break; + } } } @@ -1179,8 +1081,8 @@ private void updateWorldObjects() { anInt1051++; if (anInt1051 > 98) { anInt1051 = 0; - //anticheat? - //outgoing.writeOpcode(150); + // anticheat? + // outgoing.writeOpcode(150); } method63(); @@ -1228,8 +1130,7 @@ private void updateWorldObjects() { } - public static AbstractMap.SimpleEntry getNextInteger( - ArrayList values) { + public static AbstractMap.SimpleEntry getNextInteger(ArrayList values) { ArrayList> frequencies = new ArrayList<>(); int maxIndex = 0; main: for (int i = 0; i < values.size(); ++i) { @@ -1237,8 +1138,7 @@ public static AbstractMap.SimpleEntry getNextInteger( for (int j = 0; j < frequencies.size(); ++j) { if (frequencies.get(j).getKey() == value) { frequencies.get(j).setValue(frequencies.get(j).getValue() + 1); - if (frequencies.get(maxIndex).getValue() < frequencies.get(j) - .getValue()) { + if (frequencies.get(maxIndex).getValue() < frequencies.get(j).getValue()) { maxIndex = j; } continue main; @@ -1260,17 +1160,16 @@ private void unlinkCaches() { } private void renderMapScene(int plane) { - int pixels[] = minimapImage.myPixels; + int pixels[] = minimapImage.myPixels; int length = pixels.length; - for (int pixel = 0; pixel < length; pixel++) { + for (int pixel = 0; pixel < length; pixel++) { pixels[pixel] = 0; } - - for (int y = 1; y < 103; y++) { + for (int y = 1; y < 103; y++) { int i1 = 24628 + (103 - y) * 512 * 4; - for (int x = 1; x < 103; x++) { + for (int x = 1; x < 103; x++) { if ((tileFlags[plane][x][y] & 0x18) == 0) scene.drawTileOnMinimapSprite(pixels, i1, plane, x, y); if (plane < 3 && (tileFlags[plane + 1][x][y] & 8) != 0) @@ -1284,8 +1183,8 @@ private void renderMapScene(int plane) { int l1 = 0xEE0000; minimapImage.init(); - for (int y = 1; y < 103; y++) { - for (int x = 1; x < 103; x++) { + for (int y = 1; y < 103; y++) { + for (int x = 1; x < 103; x++) { if ((tileFlags[plane][x][y] & 0x18) == 0) drawMapScenes(y, j1, x, l1, plane); if (plane < 3 && (tileFlags[plane + 1][x][y] & 8) != 0) @@ -1297,22 +1196,22 @@ private void renderMapScene(int plane) { gameScreenImageProducer.initDrawingArea(); anInt1071 = 0; - for (int x = 0; x < 104; x++) { - for (int y = 0; y < 104; y++) { + for (int x = 0; x < 104; x++) { + for (int y = 0; y < 104; y++) { int id = scene.getGroundDecorationUid(plane, x, y); if (id != 0) { id = id >> 14 & 0x7fff; - int function = ObjectDefinition.lookup(id).minimapFunction; + int function = ObjectDefinition.lookup(id).minimapFunction; - if (function >= 0) { - int viewportX = x; - int viewportY = y; - minimapHint[anInt1071] = mapFunctions[function]; - minimapHintX[anInt1071] = viewportX; - minimapHintY[anInt1071] = viewportY; - anInt1071++; - } + if (function >= 0) { + int viewportX = x; + int viewportY = y; + minimapHint[anInt1071] = mapFunctions[function]; + minimapHintX[anInt1071] = viewportX; + minimapHintY[anInt1071] = viewportY; + anInt1071++; + } } } @@ -1325,11 +1224,12 @@ private void renderMapScene(int plane) { directory.mkdir(); } BufferedImage bufferedimage = new BufferedImage(minimapImage.myWidth, minimapImage.myHeight, 1); - bufferedimage.setRGB(0, 0, minimapImage.myWidth, minimapImage.myHeight, minimapImage.myPixels, 0, minimapImage.myWidth); + bufferedimage.setRGB(0, 0, minimapImage.myWidth, minimapImage.myHeight, minimapImage.myPixels, 0, + minimapImage.myWidth); Graphics2D graphics2d = bufferedimage.createGraphics(); graphics2d.dispose(); try { - File file1 = new File("MapImageDumps/"+(directory.listFiles().length+1)+".png"); + File file1 = new File("MapImageDumps/" + (directory.listFiles().length + 1) + ".png"); ImageIO.write(bufferedimage, "png", file1); } catch (Exception e) { e.printStackTrace(); @@ -1347,8 +1247,7 @@ private void updateGroundItems(int i, int j) { } int k = 0xfa0a1f01; Object obj = null; - for (Item item = (Item) class19.reverseGetFirst(); item != null; item = - (Item) class19.reverseGetNext()) { + for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) { ItemDefinition itemDef = ItemDefinition.lookup(item.ID); int l = itemDef.value; if (itemDef.stackable) @@ -1365,39 +1264,37 @@ private void updateGroundItems(int i, int j) { Object obj1 = null; Object obj2 = null; for (Item class30_sub2_sub4_sub2_1 = (Item) class19 - .reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = - (Item) class19.reverseGetNext()) { + .reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19 + .reverseGetNext()) { if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && obj1 == null) obj1 = class30_sub2_sub4_sub2_1; - if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID - && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID && obj2 == null) + if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID + && obj2 == null) obj2 = class30_sub2_sub4_sub2_1; } int i1 = i + (j << 7) + 0x60000000; - scene.addGroundItemTile(i, i1, ((Renderable) (obj1)), - getCenterHeight(plane, j * 128 + 64, i * 128 + 64), ((Renderable) (obj2)), - ((Renderable) (obj)), plane, j); + scene.addGroundItemTile(i, i1, ((Renderable) (obj1)), getCenterHeight(plane, j * 128 + 64, i * 128 + 64), + ((Renderable) (obj2)), ((Renderable) (obj)), plane, j); } private boolean prioritizedNpc(Npc npc) { - - //Check if it's being interacted with - if(localPlayer.interactingEntity != -1 && - localPlayer.interactingEntity < 32768) { - if(npc.index == localPlayer.interactingEntity) { + + // Check if it's being interacted with + if (localPlayer.interactingEntity != -1 && localPlayer.interactingEntity < 32768) { + if (npc.index == localPlayer.interactingEntity) { return true; } } - + return npc.desc.priorityRender; } - + private void showPrioritizedNPCs() { for (int index = 0; index < npcCount; index++) { Npc npc = npcs[npcIndices[index]]; - - if(prioritizedNpc(npc)) { + + if (prioritizedNpc(npc)) { showNpc(npc, index, npc.desc.priorityRender); } } @@ -1410,25 +1307,24 @@ private void showOtherNpcs() { } } - private boolean showNpc(Npc npc, int index, boolean priorityRender) { int k = 0x20000000 + (npcIndices[index] << 14); if (npc == null || !npc.isVisible() || npc.desc.priorityRender != priorityRender) return false; int l = npc.x >> 7; int i1 = npc.y >> 7; - if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104) + if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104) + return false; + if (npc.size == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) { + if (anIntArrayArray929[l][i1] == anInt1265) return false; - if (npc.size == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) { - if (anIntArrayArray929[l][i1] == anInt1265) - return false; - anIntArrayArray929[l][i1] = anInt1265; - } - if (!npc.desc.clickable) - k += 0x80000000; - scene.addAnimableA(plane, npc.orientation, getCenterHeight(plane, npc.y, npc.x), k, npc.y, - (npc.size - 1) * 64 + 60, npc.x, npc, npc.animationStretches); - return true; + anIntArrayArray929[l][i1] = anInt1265; + } + if (!npc.desc.clickable) + k += 0x80000000; + scene.addAnimableA(plane, npc.orientation, getCenterHeight(plane, npc.y, npc.x), k, npc.y, + (npc.size - 1) * 64 + 60, npc.x, npc, npc.animationStretches); + return true; } private void showNPCs(boolean flag) { @@ -1465,43 +1361,38 @@ private void buildInterfaceMenu(int i, Widget widget, int k, int l, int i1, int int i2 = widget.childX[l1] + i; int j2 = (widget.childY[l1] + l) - j1; Widget childInterface = Widget.interfaceCache[widget.children[l1]]; - if(childInterface == null) { + if (childInterface == null) { continue; } i2 += childInterface.horizontalOffset; j2 += childInterface.verticalOffset; - if ((childInterface.hoverType >= 0 || childInterface.defaultHoverColor != 0) - && k >= i2 && i1 >= j2 && k < i2 + childInterface.width - && i1 < j2 + childInterface.height) + if ((childInterface.hoverType >= 0 || childInterface.defaultHoverColor != 0) && k >= i2 && i1 >= j2 + && k < i2 + childInterface.width && i1 < j2 + childInterface.height) if (childInterface.hoverType >= 0) anInt886 = childInterface.hoverType; else anInt886 = childInterface.id; - if (childInterface.type == 8 && k >= i2 && i1 >= j2 - && k < i2 + childInterface.width && i1 < j2 + childInterface.height) { + if (childInterface.type == 8 && k >= i2 && i1 >= j2 && k < i2 + childInterface.width + && i1 < j2 + childInterface.height) { anInt1315 = childInterface.id; } if (childInterface.type == Widget.TYPE_CONTAINER) { - buildInterfaceMenu(i2, childInterface, k, j2, i1, - childInterface.scrollPosition); + buildInterfaceMenu(i2, childInterface, k, j2, i1, childInterface.scrollPosition); if (childInterface.scrollMax > childInterface.height) - method65(i2 + childInterface.width, childInterface.height, k, i1, - childInterface, j2, true, childInterface.scrollMax); + method65(i2 + childInterface.width, childInterface.height, k, i1, childInterface, j2, true, + childInterface.scrollMax); } else { if (childInterface.atActionType == Widget.OPTION_OK && k >= i2 && i1 >= j2 - && k < i2 + childInterface.width - && i1 < j2 + childInterface.height) { + && k < i2 + childInterface.width && i1 < j2 + childInterface.height) { boolean flag = false; if (childInterface.contentType != 0) flag = buildFriendsListMenu(childInterface); - if(childInterface.tooltip == null || - childInterface.tooltip.length() == 0) { + if (childInterface.tooltip == null || childInterface.tooltip.length() == 0) { flag = true; } if (!flag) { - if (Configuration.enableIds - && (myPrivilege >= 2 && myPrivilege <= 3)) { - menuActionText[menuActionRow] = childInterface.tooltip + " "+childInterface.id; + if (Configuration.enableIds && (myPrivilege >= 2 && myPrivilege <= 3)) { + menuActionText[menuActionRow] = childInterface.tooltip + " " + childInterface.id; menuActionTypes[menuActionRow] = 315; secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; @@ -1513,51 +1404,42 @@ private void buildInterfaceMenu(int i, Widget widget, int k, int l, int i1, int } } } - if (childInterface.atActionType == Widget.OPTION_USABLE && spellSelected == 0 - && k >= i2 && i1 >= j2 && k < i2 + childInterface.width - && i1 < j2 + childInterface.height) { + if (childInterface.atActionType == Widget.OPTION_USABLE && spellSelected == 0 && k >= i2 && i1 >= j2 + && k < i2 + childInterface.width && i1 < j2 + childInterface.height) { String s = childInterface.selectedActionName; if (s.indexOf(" ") != -1) s = s.substring(0, s.indexOf(" ")); - if (childInterface.spellName.endsWith("Rush") - || childInterface.spellName.endsWith("Burst") + if (childInterface.spellName.endsWith("Rush") || childInterface.spellName.endsWith("Burst") || childInterface.spellName.endsWith("Blitz") || childInterface.spellName.endsWith("Barrage") - || childInterface.spellName.endsWith("strike") - || childInterface.spellName.endsWith("bolt") + || childInterface.spellName.endsWith("strike") || childInterface.spellName.endsWith("bolt") || childInterface.spellName.equals("Crumble undead") - || childInterface.spellName.endsWith("blast") - || childInterface.spellName.endsWith("wave") + || childInterface.spellName.endsWith("blast") || childInterface.spellName.endsWith("wave") || childInterface.spellName.equals("Claws of Guthix") || childInterface.spellName.equals("Flames of Zamorak") || childInterface.spellName.equals("Magic Dart")) { - menuActionText[menuActionRow] = - "Autocast @gre@" + childInterface.spellName; + menuActionText[menuActionRow] = "Autocast @gre@" + childInterface.spellName; menuActionTypes[menuActionRow] = 104; secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } - menuActionText[menuActionRow] = - s + " @gre@" + childInterface.spellName; + menuActionText[menuActionRow] = s + " @gre@" + childInterface.spellName; menuActionTypes[menuActionRow] = 626; secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } if (childInterface.atActionType == Widget.OPTION_CLOSE && k >= i2 && i1 >= j2 - && k < i2 + childInterface.width - && i1 < j2 + childInterface.height) { + && k < i2 + childInterface.width && i1 < j2 + childInterface.height) { menuActionText[menuActionRow] = "Close"; menuActionTypes[menuActionRow] = 200; secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } - if (childInterface.atActionType == Widget.OPTION_TOGGLE_SETTING && k >= i2 - && i1 >= j2 && k < i2 + childInterface.width - && i1 < j2 + childInterface.height) { - if (Configuration.enableIds - && (myPrivilege >= 2 && myPrivilege <= 3)) { - menuActionText[menuActionRow] = childInterface.tooltip + " @lre@("+childInterface.id+")"; + if (childInterface.atActionType == Widget.OPTION_TOGGLE_SETTING && k >= i2 && i1 >= j2 + && k < i2 + childInterface.width && i1 < j2 + childInterface.height) { + if (Configuration.enableIds && (myPrivilege >= 2 && myPrivilege <= 3)) { + menuActionText[menuActionRow] = childInterface.tooltip + " @lre@(" + childInterface.id + ")"; } else { menuActionText[menuActionRow] = childInterface.tooltip; } @@ -1566,18 +1448,16 @@ private void buildInterfaceMenu(int i, Widget widget, int k, int l, int i1, int menuActionRow++; } - if (childInterface.atActionType == Widget.OPTION_RESET_SETTING && k >= i2 - && i1 >= j2 && k < i2 + childInterface.width - && i1 < j2 + childInterface.height) { + if (childInterface.atActionType == Widget.OPTION_RESET_SETTING && k >= i2 && i1 >= j2 + && k < i2 + childInterface.width && i1 < j2 + childInterface.height) { boolean flag = false; - if(childInterface.tooltip == null || - childInterface.tooltip.length() == 0) { + if (childInterface.tooltip == null || childInterface.tooltip.length() == 0) { flag = true; } if (!flag) { - if (Configuration.enableIds - && (myPrivilege >= 2 && myPrivilege <= 3)) { - menuActionText[menuActionRow] = childInterface.tooltip + " @lre@("+childInterface.id+")"; + if (Configuration.enableIds && (myPrivilege >= 2 && myPrivilege <= 3)) { + menuActionText[menuActionRow] = childInterface.tooltip + " @lre@(" + childInterface.id + + ")"; } else { menuActionText[menuActionRow] = childInterface.tooltip; } @@ -1587,44 +1467,49 @@ private void buildInterfaceMenu(int i, Widget widget, int k, int l, int i1, int } } - if (childInterface.atActionType == Widget.OPTION_CONTINUE - && !continuedDialogue && k >= i2 && i1 >= j2 - && k < i2 + childInterface.width - && i1 < j2 + childInterface.height) { + if (childInterface.atActionType == Widget.OPTION_CONTINUE && !continuedDialogue && k >= i2 && i1 >= j2 + && k < i2 + childInterface.width && i1 < j2 + childInterface.height) { menuActionText[menuActionRow] = childInterface.tooltip; menuActionTypes[menuActionRow] = 679; secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } - if (k >= i2 && i1 >= j2 - && k < i2 + (childInterface.type == 4 ? 100 - : childInterface.width) + if (k >= i2 && i1 >= j2 && k < i2 + (childInterface.type == 4 ? 100 : childInterface.width) && i1 < j2 + childInterface.height) { - if (childInterface.actions != null && !childInterface.invisible && !childInterface.drawingDisabled) { + if (childInterface.actions != null && !childInterface.invisible + && !childInterface.drawingDisabled) { - if(!(childInterface.contentType == 206 && interfaceIsSelected(childInterface))) { - if ((childInterface.type == 4 && childInterface.defaultText.length() > 0) || childInterface.type == 5) { + if (!(childInterface.contentType == 206 && interfaceIsSelected(childInterface))) { + if ((childInterface.type == 4 && childInterface.defaultText.length() > 0) + || childInterface.type == 5) { boolean drawOptions = true; - //HARDCODE CLICKABLE TEXT HERE - if(childInterface.parent == 37128) { //Clan chat interface, dont show options for guests + // HARDCODE CLICKABLE TEXT HERE + if (childInterface.parent == 37128) { // Clan + // chat + // interface, + // dont + // show + // options + // for + // guests drawOptions = showClanOptions; } - if(drawOptions) { - for (int action = childInterface.actions.length - - 1; action >= 0; action--) { + if (drawOptions) { + for (int action = childInterface.actions.length - 1; action >= 0; action--) { if (childInterface.actions[action] != null) { - String s = childInterface.actions[action] + (childInterface.type == 4 ? " @or1@" + childInterface.defaultText : ""); + String s = childInterface.actions[action] + (childInterface.type == 4 + ? " @or1@" + childInterface.defaultText : ""); - if(s.contains("img")) { + if (s.contains("img")) { int prefix = s.indexOf(""); s = s.replaceAll(s.substring(prefix + 5, suffix), ""); s = s.replaceAll("", ""); - s = s.replaceAll("", ""); + s = s.replaceAll("", ""); } menuActionText[menuActionRow] = s; @@ -1640,7 +1525,9 @@ private void buildInterfaceMenu(int i, Widget widget, int k, int l, int i1, int } } - if (childInterface.type == Widget.TYPE_INVENTORY && !childInterface.invisible && !childInterface.drawingDisabled && !(childInterface.id >= 22035 && childInterface.id <= 22042)) { + if (childInterface.type == Widget.TYPE_INVENTORY && !childInterface.invisible + && !childInterface.drawingDisabled + && !(childInterface.id >= 22035 && childInterface.id <= 22042)) { int k2 = 0; for (int l2 = 0; l2 < childInterface.height; l2++) { for (int i3 = 0; i3 < childInterface.width; i3++) { @@ -1653,186 +1540,126 @@ private void buildInterfaceMenu(int i, Widget widget, int k, int l, int i1, int if (k >= j3 && i1 >= k3 && k < j3 + 32 && i1 < k3 + 32) { mouseInvInterfaceIndex = k2; lastActiveInvInterface = childInterface.id; - if(k2 >= childInterface.inventoryItemId.length) { + if (k2 >= childInterface.inventoryItemId.length) { continue; } if (childInterface.inventoryItemId[k2] > 0) { ItemDefinition itemDef = ItemDefinition - .lookup(childInterface.inventoryItemId[k2] - - 1); - if (itemSelected == 1 - && childInterface.hasActions) { - if (childInterface.id != anInt1284 - || k2 != anInt1283) { - menuActionText[menuActionRow] = - "Use " + selectedItemName - + " with @lre@" + .lookup(childInterface.inventoryItemId[k2] - 1); + if (itemSelected == 1 && childInterface.hasActions) { + if (childInterface.id != anInt1284 || k2 != anInt1283) { + menuActionText[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name; - menuActionTypes[menuActionRow] = - 870; - selectedMenuActions[menuActionRow] = - itemDef.id; - firstMenuAction[menuActionRow] = - k2; - secondMenuAction[menuActionRow] = - childInterface.id; + menuActionTypes[menuActionRow] = 870; + selectedMenuActions[menuActionRow] = itemDef.id; + firstMenuAction[menuActionRow] = k2; + secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } - } else if (spellSelected == 1 - && childInterface.hasActions) { + } else if (spellSelected == 1 && childInterface.hasActions) { if ((spellUsableOn & 0x10) == 16) { - menuActionText[menuActionRow] = - spellTooltip + " @lre@" - + itemDef.name; - menuActionTypes[menuActionRow] = - 543; - selectedMenuActions[menuActionRow] = - itemDef.id; - firstMenuAction[menuActionRow] = - k2; - secondMenuAction[menuActionRow] = - childInterface.id; + menuActionText[menuActionRow] = spellTooltip + " @lre@" + itemDef.name; + menuActionTypes[menuActionRow] = 543; + selectedMenuActions[menuActionRow] = itemDef.id; + firstMenuAction[menuActionRow] = k2; + secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } } else { if (childInterface.hasActions) { for (int l3 = 4; l3 >= 3; l3--) - if (itemDef.actions != null - && itemDef.actions[l3] != null) { - menuActionText[menuActionRow] = - itemDef.actions[l3] - + " @lre@" - + itemDef.name; + if (itemDef.actions != null && itemDef.actions[l3] != null) { + menuActionText[menuActionRow] = itemDef.actions[l3] + " @lre@" + + itemDef.name; if (l3 == 3) - menuActionTypes[menuActionRow] = - 493; + menuActionTypes[menuActionRow] = 493; if (l3 == 4) - menuActionTypes[menuActionRow] = - 847; - selectedMenuActions[menuActionRow] = - itemDef.id; - firstMenuAction[menuActionRow] = - k2; - secondMenuAction[menuActionRow] = - childInterface.id; + menuActionTypes[menuActionRow] = 847; + selectedMenuActions[menuActionRow] = itemDef.id; + firstMenuAction[menuActionRow] = k2; + secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } else if (l3 == 4) { - menuActionText[menuActionRow] = - "Drop @lre@" + itemDef.name; - menuActionTypes[menuActionRow] = - 847; - selectedMenuActions[menuActionRow] = - itemDef.id; - firstMenuAction[menuActionRow] = - k2; - secondMenuAction[menuActionRow] = - childInterface.id; + menuActionText[menuActionRow] = "Drop @lre@" + itemDef.name; + menuActionTypes[menuActionRow] = 847; + selectedMenuActions[menuActionRow] = itemDef.id; + firstMenuAction[menuActionRow] = k2; + secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } } if (childInterface.usableItems) { - menuActionText[menuActionRow] = - "Use @lre@" + itemDef.name; - menuActionTypes[menuActionRow] = - 447; - selectedMenuActions[menuActionRow] = - itemDef.id; - firstMenuAction[menuActionRow] = - k2; - secondMenuAction[menuActionRow] = - childInterface.id; + menuActionText[menuActionRow] = "Use @lre@" + itemDef.name; + menuActionTypes[menuActionRow] = 447; + selectedMenuActions[menuActionRow] = itemDef.id; + firstMenuAction[menuActionRow] = k2; + secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } - if (childInterface.hasActions - && itemDef.actions != null) { + if (childInterface.hasActions && itemDef.actions != null) { for (int i4 = 2; i4 >= 0; i4--) if (itemDef.actions[i4] != null) { - menuActionText[menuActionRow] = - itemDef.actions[i4] - + " @lre@" - + itemDef.name; + menuActionText[menuActionRow] = itemDef.actions[i4] + " @lre@" + + itemDef.name; if (i4 == 0) - menuActionTypes[menuActionRow] = - 74; + menuActionTypes[menuActionRow] = 74; if (i4 == 1) - menuActionTypes[menuActionRow] = - 454; + menuActionTypes[menuActionRow] = 454; if (i4 == 2) - menuActionTypes[menuActionRow] = - 539; - selectedMenuActions[menuActionRow] = - itemDef.id; - firstMenuAction[menuActionRow] = - k2; - secondMenuAction[menuActionRow] = - childInterface.id; + menuActionTypes[menuActionRow] = 539; + selectedMenuActions[menuActionRow] = itemDef.id; + firstMenuAction[menuActionRow] = k2; + secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } } - //Menu actions, item options etc in interfaces - //Hardcoding + // Menu actions, item options etc in + // interfaces + // Hardcoding if (childInterface.actions != null) { - for (int type = - 4; type >= 0; type--) { + for (int type = 4; type >= 0; type--) { if (childInterface.actions[type] != null) { String action = childInterface.actions[type]; - //HARDCODING OF MENU ACTIONS - if(openInterfaceId == 42000) { + // HARDCODING OF MENU + // ACTIONS + if (openInterfaceId == 42000) { action = action.replace("Offer", "Pricecheck"); } menuActionText[menuActionRow] = action + " @lre@" + itemDef.name; if (type == 0) - menuActionTypes[menuActionRow] = - 632; + menuActionTypes[menuActionRow] = 632; if (type == 1) - menuActionTypes[menuActionRow] = - 78; + menuActionTypes[menuActionRow] = 78; if (type == 2) - menuActionTypes[menuActionRow] = - 867; + menuActionTypes[menuActionRow] = 867; if (type == 3) - menuActionTypes[menuActionRow] = - 431; + menuActionTypes[menuActionRow] = 431; if (type == 4) - menuActionTypes[menuActionRow] = - 53; - selectedMenuActions[menuActionRow] = - itemDef.id; - firstMenuAction[menuActionRow] = - k2; - secondMenuAction[menuActionRow] = - childInterface.id; + menuActionTypes[menuActionRow] = 53; + selectedMenuActions[menuActionRow] = itemDef.id; + firstMenuAction[menuActionRow] = k2; + secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } } } - if (Configuration.enableIds - && (myPrivilege >= 2 - && myPrivilege <= 3)) { - menuActionText[menuActionRow] = - "Examine @lre@" - + itemDef.name - + " @gre@(@whi@" - + (childInterface.inventoryItemId[k2] - - 1) - + "@gre@)"; + if (Configuration.enableIds && (myPrivilege >= 2 && myPrivilege <= 3)) { + menuActionText[menuActionRow] = "Examine @lre@" + itemDef.name + + " @gre@(@whi@" + (childInterface.inventoryItemId[k2] - 1) + + "@gre@)"; } else { - menuActionText[menuActionRow] = - "Examine @lre@" - + itemDef.name; + menuActionText[menuActionRow] = "Examine @lre@" + itemDef.name; } menuActionTypes[menuActionRow] = 1125; - selectedMenuActions[menuActionRow] = - itemDef.id; + selectedMenuActions[menuActionRow] = itemDef.id; firstMenuAction[menuActionRow] = k2; - secondMenuAction[menuActionRow] = - childInterface.id; + secondMenuAction[menuActionRow] = childInterface.id; menuActionRow++; } } @@ -1862,8 +1689,7 @@ public void drawTransparentScrollBar(int x, int y, int height, int maxScroll, in 5 + y + 16 + barPos + barHeight - 5 - (y + 16 + barPos), 0xffffff, 32); } - public void drawScrollbar(int height, int pos, int y, int x, int maxScroll, - boolean transparent) { + public void drawScrollbar(int height, int pos, int y, int x, int maxScroll, boolean transparent) { if (transparent) { drawTransparentScrollBar(x, y, height, maxScroll, pos); } else { @@ -2002,14 +1828,13 @@ private void updateNPCs(Buffer stream, int i) { } if (stream.currentPosition != i) { - SignLink.reporterror(myUsername + " size mismatch in getnpcpos - pos:" - + stream.currentPosition + " psize:" + i); + SignLink.reporterror( + myUsername + " size mismatch in getnpcpos - pos:" + stream.currentPosition + " psize:" + i); throw new RuntimeException("eek"); } for (int i1 = 0; i1 < npcCount; i1++) if (npcs[npcIndices[i1]] == null) { - SignLink.reporterror(myUsername + " null entry in npc list - pos:" + i1 - + " size:" + npcCount); + SignLink.reporterror(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount); throw new RuntimeException("eek"); } @@ -2022,8 +1847,7 @@ private void updateNPCs(Buffer stream, int i) { public void processChatModeClick() { final int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 503; - if (super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= yOffset + 482 - && super.mouseY <= yOffset + 503) { + if (super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= yOffset + 482 && super.mouseY <= yOffset + 503) { cButtonHPos = 0; updateChatbox = true; } else if (super.mouseX >= 71 && super.mouseX <= 127 && super.mouseY >= yOffset + 482 @@ -2055,8 +1879,7 @@ public void processChatModeClick() { updateChatbox = true; } if (super.clickMode3 == 1) { - if (super.saveClickX >= 5 && super.saveClickX <= 61 - && super.saveClickY >= yOffset + 482 + if (super.saveClickX >= 5 && super.saveClickX <= 61 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) { if (frameMode != ScreenMode.FIXED) { if (setChannel != 0) { @@ -2073,8 +1896,7 @@ public void processChatModeClick() { updateChatbox = true; setChannel = 0; } - } else if (super.saveClickX >= 71 && super.saveClickX <= 127 - && super.saveClickY >= yOffset + 482 + } else if (super.saveClickX >= 71 && super.saveClickX <= 127 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) { if (frameMode != ScreenMode.FIXED) { if (setChannel != 1 && frameMode != ScreenMode.FIXED) { @@ -2091,8 +1913,7 @@ public void processChatModeClick() { updateChatbox = true; setChannel = 1; } - } else if (super.saveClickX >= 137 && super.saveClickX <= 193 - && super.saveClickY >= yOffset + 482 + } else if (super.saveClickX >= 137 && super.saveClickX <= 193 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) { if (frameMode != ScreenMode.FIXED) { if (setChannel != 2 && frameMode != ScreenMode.FIXED) { @@ -2109,8 +1930,7 @@ public void processChatModeClick() { updateChatbox = true; setChannel = 2; } - } else if (super.saveClickX >= 203 && super.saveClickX <= 259 - && super.saveClickY >= yOffset + 482 + } else if (super.saveClickX >= 203 && super.saveClickX <= 259 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) { if (frameMode != ScreenMode.FIXED) { if (setChannel != 3 && frameMode != ScreenMode.FIXED) { @@ -2127,8 +1947,7 @@ public void processChatModeClick() { updateChatbox = true; setChannel = 3; } - } else if (super.saveClickX >= 269 && super.saveClickX <= 325 - && super.saveClickY >= yOffset + 482 + } else if (super.saveClickX >= 269 && super.saveClickX <= 325 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) { if (frameMode != ScreenMode.FIXED) { if (setChannel != 4 && frameMode != ScreenMode.FIXED) { @@ -2145,8 +1964,7 @@ public void processChatModeClick() { updateChatbox = true; setChannel = 4; } - } else if (super.saveClickX >= 335 && super.saveClickX <= 391 - && super.saveClickY >= yOffset + 482 + } else if (super.saveClickX >= 335 && super.saveClickX <= 391 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) { if (frameMode != ScreenMode.FIXED) { if (setChannel != 5 && frameMode != ScreenMode.FIXED) { @@ -2163,25 +1981,21 @@ public void processChatModeClick() { updateChatbox = true; setChannel = 5; } - } else if (super.saveClickX >= 404 && super.saveClickX <= 515 - && super.saveClickY >= yOffset + 482 + } else if (super.saveClickX >= 404 && super.saveClickX <= 515 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) { if (openInterfaceId == -1) { clearTopInterfaces(); reportAbuseInput = ""; canMute = false; for (int i = 0; i < Widget.interfaceCache.length; i++) { - if (Widget.interfaceCache[i] == null - || Widget.interfaceCache[i].contentType != 600) { + if (Widget.interfaceCache[i] == null || Widget.interfaceCache[i].contentType != 600) { continue; } - reportAbuseInterfaceID = - openInterfaceId = Widget.interfaceCache[i].parent; + reportAbuseInterfaceID = openInterfaceId = Widget.interfaceCache[i].parent; break; } } else { - sendMessage("Please close the interface you have open before using 'report abuse'", - 0, ""); + sendMessage("Please close the interface you have open before using 'report abuse'", 0, ""); } } } @@ -2189,7 +2003,6 @@ public void processChatModeClick() { public void updateVarp(int id) { - int parameter = VariablePlayer.variables[id].getActionId(); if (parameter == 0) { @@ -2313,7 +2126,7 @@ public void updateVarp(int id) { public FileArchive mediaStreamLoader; - private final int[] hitmarks562 = {31, 32, 33, 34}; + private final int[] hitmarks562 = { 31, 32, 33, 34 }; public void updateEntities() { try { @@ -2332,8 +2145,7 @@ else if (j < playerCount) NpcDefinition entityDef = ((Npc) obj).desc; if (Configuration.namesAboveHeads) { npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height + 15); - smallText.drawText(0x0099FF, entityDef.name, spriteDrawY - 5, - spriteDrawX); // -15 + smallText.drawText(0x0099FF, entityDef.name, spriteDrawY - 5, spriteDrawX); // -15 // from // original } @@ -2350,56 +2162,45 @@ else if (j < playerCount) npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height + 15); if (spriteDrawX > -1) { if (player.skullIcon < 2) { - skullIcons[player.skullIcon].drawSprite( - spriteDrawX - 12, spriteDrawY - l); + skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l); l += 25; if (Configuration.hpAboveHeads && Configuration.namesAboveHeads) { text_over_head_offset -= 25; } else if (Configuration.namesAboveHeads) { text_over_head_offset -= 23; - } else if(Configuration.hpAboveHeads) { + } else if (Configuration.hpAboveHeads) { text_over_head_offset -= 33; } } if (player.headIcon < 13) { - headIcons[player.headIcon].drawSprite( - spriteDrawX - 12, spriteDrawY - l - 3); + headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l - 3); l += 18; if (Configuration.hpAboveHeads && Configuration.namesAboveHeads) { text_over_head_offset -= 25; } else if (Configuration.namesAboveHeads) { text_over_head_offset -= 26; - } else if(Configuration.hpAboveHeads) { + } else if (Configuration.hpAboveHeads) { text_over_head_offset -= 33; } } } } - if (j >= 0 && hintIconDrawType == 10 - && hintIconPlayerId == playerList[j]) { + if (j >= 0 && hintIconDrawType == 10 && hintIconPlayerId == playerList[j]) { npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height + 15); if (spriteDrawX > -1) - headIconsHint[player.hintIcon].drawSprite( - spriteDrawX - 12, spriteDrawY - l); + headIconsHint[player.hintIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l); } if (Configuration.hpAboveHeads && Configuration.namesAboveHeads) { newSmallFont.drawCenteredString( - (new StringBuilder()) - .append(((Mob) (Mob) obj).currentHealth) - .append("/") - .append(((Mob) (Mob) obj).maxHealth) - .toString(), + (new StringBuilder()).append(((Mob) obj).currentHealth).append("/") + .append(((Mob) obj).maxHealth).toString(), spriteDrawX, spriteDrawY - 29 + text_over_head_offset, 0x3399ff, 100); } // draws HP above head - else if (Configuration.hpAboveHeads - && !Configuration.namesAboveHeads) { + else if (Configuration.hpAboveHeads && !Configuration.namesAboveHeads) { newSmallFont.drawCenteredString( - (new StringBuilder()) - .append(((Mob) (Mob) obj).currentHealth) - .append("/") - .append(((Mob) (Mob) obj).maxHealth) - .toString(), + (new StringBuilder()).append(((Mob) obj).currentHealth).append("/") + .append(((Mob) obj).maxHealth).toString(), spriteDrawX, spriteDrawY - 5 + text_over_head_offset, 0x3399ff, 100); } if (Configuration.namesAboveHeads) { @@ -2407,38 +2208,32 @@ else if (Configuration.hpAboveHeads int col = 0x0000ff; if (player.clanName == localPlayer.clanName) col = 0x00ff00; - smallText.drawText(col, player.name, spriteDrawY - 15 + text_over_head_offset, - spriteDrawX); - /*if (player.clanName != "" && player.clanName != "None") - smallText.drawText(col, "<" + player.clanName + ">", - spriteDrawY - 5 + text_over_head_offset, spriteDrawX);*/ + smallText.drawText(col, player.name, spriteDrawY - 15 + text_over_head_offset, spriteDrawX); + /* + * if (player.clanName != "" && player.clanName != + * "None") smallText.drawText(col, "<" + player.clanName + * + ">", spriteDrawY - 5 + text_over_head_offset, + * spriteDrawX); + */ } } else { NpcDefinition entityDef_1 = ((Npc) obj).desc; - if (entityDef_1.headIcon >= 0 - && entityDef_1.headIcon < headIcons.length) { + if (entityDef_1.headIcon >= 0 && entityDef_1.headIcon < headIcons.length) { npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height + 15); if (spriteDrawX > -1) - headIcons[entityDef_1.headIcon].drawSprite( - spriteDrawX - 12, spriteDrawY - 30); + headIcons[entityDef_1.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - 30); } - if (hintIconDrawType == 1 - && hintIconNpcId == npcIndices[j - playerCount] - && tick % 20 < 10) { + if (hintIconDrawType == 1 && hintIconNpcId == npcIndices[j - playerCount] && tick % 20 < 10) { npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height + 15); if (spriteDrawX > -1) - headIconsHint[0].drawSprite(spriteDrawX - 12, - spriteDrawY - 28); + headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28); } } - if (((Mob) (obj)).spokenText != null && (j >= playerCount - || publicChatMode == 0 || publicChatMode == 3 - || publicChatMode == 1 - && isFriendOrSelf(((Player) obj).name))) { + if (((Mob) (obj)).spokenText != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 + || publicChatMode == 1 && isFriendOrSelf(((Player) obj).name))) { npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height); if (spriteDrawX > -1 && messageLength < anInt975) { - anIntArray979[messageLength] = - boldText.method384(((Mob) (obj)).spokenText) / 2; + anIntArray979[messageLength] = boldText.method384(((Mob) (obj)).spokenText) / 2; anIntArray978[messageLength] = boldText.verticalSpace; anIntArray976[messageLength] = spriteDrawX; anIntArray977[messageLength] = spriteDrawY; @@ -2446,8 +2241,7 @@ && isFriendOrSelf(((Player) obj).name))) { anIntArray981[messageLength] = ((Mob) (obj)).textEffect; anIntArray982[messageLength] = ((Mob) (obj)).textCycle; aStringArray983[messageLength++] = ((Mob) (obj)).spokenText; - if (anInt1249 == 0 && ((Mob) (obj)).textEffect >= 1 - && ((Mob) (obj)).textEffect <= 3) { + if (anInt1249 == 0 && ((Mob) (obj)).textEffect >= 1 && ((Mob) (obj)).textEffect <= 3) { anIntArray978[messageLength] += 10; anIntArray977[messageLength] += 5; } @@ -2461,24 +2255,19 @@ && isFriendOrSelf(((Player) obj).name))) { try { npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height + 15); if (spriteDrawX > -1) { - int i1 = (((Mob) (obj)).currentHealth * 30) - / ((Mob) (obj)).maxHealth; + int i1 = (((Mob) (obj)).currentHealth * 30) / ((Mob) (obj)).maxHealth; if (i1 > 30) { i1 = 30; } - int hpPercent = (((Mob) (obj)).currentHealth * 56) - / ((Mob) (obj)).maxHealth; + int hpPercent = (((Mob) (obj)).currentHealth * 56) / ((Mob) (obj)).maxHealth; if (hpPercent > 56) { hpPercent = 56; } if (!Configuration.hpBar554) { - Rasterizer2D.drawBox(spriteDrawX - 15, spriteDrawY - 3, i1, 5, - 65280); - Rasterizer2D.drawBox((spriteDrawX - 15) + i1, spriteDrawY - 3, 30 - i1, 5, - 0xff0000 - ); + Rasterizer2D.drawBox(spriteDrawX - 15, spriteDrawY - 3, i1, 5, 65280); + Rasterizer2D.drawBox((spriteDrawX - 15) + i1, spriteDrawY - 3, 30 - i1, 5, 0xff0000); } else { cacheSprite[41].drawSprite(spriteDrawX - 28, spriteDrawY - 3); cacheSprite[40] = new Sprite(hp, hpPercent, 7); @@ -2491,8 +2280,7 @@ && isFriendOrSelf(((Player) obj).name))) { if (!Configuration.hitmarks554) { for (int j1 = 0; j1 < 4; j1++) { if (((Mob) (obj)).hitsLoopCycle[j1] > tick) { - npcScreenPos(((Mob) (obj)), - ((Mob) (obj)).height / 2); + npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height / 2); if (spriteDrawX > -1) { if (j1 == 1) spriteDrawY -= 20; @@ -2504,77 +2292,52 @@ && isFriendOrSelf(((Player) obj).name))) { spriteDrawX += 15; spriteDrawY -= 10; } - hitMarks[((Mob) (obj)).hitMarkTypes[j1]] - .drawSprite(spriteDrawX - 12, - spriteDrawY - 12); + hitMarks[((Mob) (obj)).hitMarkTypes[j1]].drawSprite(spriteDrawX - 12, spriteDrawY - 12); smallText.drawText(0, - Configuration.tenXHp - ? String.valueOf( - ((Mob) (obj)).hitDamages[j1] - * 10) - : String.valueOf( - ((Mob) (obj)).hitDamages[j1] - * 1), - spriteDrawY + 4, spriteDrawX); + Configuration.tenXHp ? String.valueOf(((Mob) (obj)).hitDamages[j1] * 10) + : String.valueOf(((Mob) (obj)).hitDamages[j1] * 1), + spriteDrawY + 4, spriteDrawX); smallText.drawText(0xffffff, - Configuration.tenXHp - ? String.valueOf( - ((Mob) (obj)).hitDamages[j1] - * 10) - : String.valueOf( - ((Mob) (obj)).hitDamages[j1] - * 1), - spriteDrawY + 3, spriteDrawX - 1); + Configuration.tenXHp ? String.valueOf(((Mob) (obj)).hitDamages[j1] * 10) + : String.valueOf(((Mob) (obj)).hitDamages[j1] * 1), + spriteDrawY + 3, spriteDrawX - 1); } } } } else { for (int j2 = 0; j2 < 4; j2++) { if (((Mob) (obj)).hitsLoopCycle[j2] > tick) { - npcScreenPos(((Mob) (obj)), - ((Mob) (obj)).height / 2); + npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height / 2); if (spriteDrawX > -1) { if (j2 == 0 && ((Mob) (obj)).hitDamages[j2] > 99) ((Mob) (obj)).hitMarkTypes[j2] = 3; - else if (j2 == 1 - && ((Mob) (obj)).hitDamages[j2] > 99) + else if (j2 == 1 && ((Mob) (obj)).hitDamages[j2] > 99) ((Mob) (obj)).hitMarkTypes[j2] = 3; - else if (j2 == 2 - && ((Mob) (obj)).hitDamages[j2] > 99) + else if (j2 == 2 && ((Mob) (obj)).hitDamages[j2] > 99) ((Mob) (obj)).hitMarkTypes[j2] = 3; - else if (j2 == 3 - && ((Mob) (obj)).hitDamages[j2] > 99) + else if (j2 == 3 && ((Mob) (obj)).hitDamages[j2] > 99) ((Mob) (obj)).hitMarkTypes[j2] = 3; if (j2 == 1) { spriteDrawY -= 20; } if (j2 == 2) { - spriteDrawX -= - (((Mob) (obj)).hitDamages[j2] > 99 - ? 30 : 20); + spriteDrawX -= (((Mob) (obj)).hitDamages[j2] > 99 ? 30 : 20); spriteDrawY -= 10; } if (j2 == 3) { - spriteDrawX += - (((Mob) (obj)).hitDamages[j2] > 99 - ? 30 : 20); + spriteDrawX += (((Mob) (obj)).hitDamages[j2] > 99 ? 30 : 20); spriteDrawY -= 10; } if (((Mob) (obj)).hitMarkTypes[j2] == 3) { spriteDrawX -= 8; } cacheSprite[hitmarks562[((Mob) (obj)).hitMarkTypes[j2]]] - .draw24BitSprite(spriteDrawX - 12, - spriteDrawY - 12); - smallText.drawText(0xffffff, - String.valueOf( - ((Mob) (obj)).hitDamages[j2]), + .draw24BitSprite(spriteDrawX - 12, spriteDrawY - 12); + smallText.drawText(0xffffff, String.valueOf(((Mob) (obj)).hitDamages[j2]), spriteDrawY + 3, - (((Mob) (obj)).hitMarkTypes[j2] == 3 - ? spriteDrawX + 7 - : spriteDrawX - 1)); + (((Mob) (obj)).hitMarkTypes[j2] == 3 ? spriteDrawX + 7 : spriteDrawX - 1)); } } } @@ -2589,11 +2352,10 @@ else if (j2 == 3 while (flag) { flag = false; for (int l2 = 0; l2 < defaultText; l2++) - if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2] - && l1 - k2 < anIntArray977[l2] + 2 + if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2] && l1 - k2 < anIntArray977[l2] + 2 && k1 - j2 < anIntArray976[l2] + anIntArray979[l2] - && k1 + j2 > anIntArray976[l2] - anIntArray979[l2] - && anIntArray977[l2] - anIntArray978[l2] < l1) { + && k1 + j2 > anIntArray976[l2] - anIntArray979[l2] + && anIntArray977[l2] - anIntArray978[l2] < l1) { l1 = anIntArray977[l2] - anIntArray978[l2]; flag = true; } @@ -2608,78 +2370,73 @@ else if (j2 == 3 i3 = anIntArray965[textColourEffect[defaultText]]; if (textColourEffect[defaultText] == 6) i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000; - if (textColourEffect[defaultText] == 7) - i3 = anInt1265 % 20 >= 10 ? 65535 : 255; - if (textColourEffect[defaultText] == 8) - i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056; - if (textColourEffect[defaultText] == 9) { - int j3 = 150 - anIntArray982[defaultText]; - if (j3 < 50) - i3 = 0xff0000 + 1280 * j3; - else if (j3 < 100) - i3 = 0xffff00 - 0x50000 * (j3 - 50); - else if (j3 < 150) - i3 = 65280 + 5 * (j3 - 100); - } - if (textColourEffect[defaultText] == 10) { - int k3 = 150 - anIntArray982[defaultText]; - if (k3 < 50) - i3 = 0xff0000 + 5 * k3; - else if (k3 < 100) - i3 = 0xff00ff - 0x50000 * (k3 - 50); - else if (k3 < 150) - i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100); - } - if (textColourEffect[defaultText] == 11) { - int l3 = 150 - anIntArray982[defaultText]; - if (l3 < 50) - i3 = 0xffffff - 0x50005 * l3; - else if (l3 < 100) - i3 = 65280 + 0x50005 * (l3 - 50); - else if (l3 < 150) - i3 = 0xffffff - 0x50000 * (l3 - 100); - } - if (anIntArray981[defaultText] == 0) { - boldText.drawText(0, s, spriteDrawY + 1, spriteDrawX); - boldText.drawText(i3, s, spriteDrawY, spriteDrawX); - } - if (anIntArray981[defaultText] == 1) { - boldText.wave(0, s, spriteDrawX, anInt1265, spriteDrawY + 1); - boldText.wave(i3, s, spriteDrawX, anInt1265, spriteDrawY); - } - if (anIntArray981[defaultText] == 2) { - boldText.wave2(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0); - boldText.wave2(spriteDrawX, s, anInt1265, spriteDrawY, i3); - } - if (anIntArray981[defaultText] == 3) { - boldText.shake(150 - anIntArray982[defaultText], s, anInt1265, - spriteDrawY + 1, spriteDrawX, 0); - boldText.shake(150 - anIntArray982[defaultText], s, anInt1265, - spriteDrawY, spriteDrawX, i3); - } - if (anIntArray981[defaultText] == 4) { - int i4 = boldText.method384(s); - int k4 = ((150 - anIntArray982[defaultText]) * (i4 + 100)) - / 150; - Rasterizer2D.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, - 0); - boldText.render(0, s, spriteDrawY + 1, (spriteDrawX + 50) - k4); - boldText.render(i3, s, spriteDrawY, (spriteDrawX + 50) - k4); - Rasterizer2D.defaultDrawingAreaSize(); - } - if (anIntArray981[defaultText] == 5) { - int j4 = 150 - anIntArray982[defaultText]; - int l4 = 0; - if (j4 < 25) - l4 = j4 - 25; - else if (j4 > 125) - l4 = j4 - 125; - Rasterizer2D.setDrawingArea(spriteDrawY + 5, 0, 512, - spriteDrawY - boldText.verticalSpace - 1); - boldText.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX); - boldText.drawText(i3, s, spriteDrawY + l4, spriteDrawX); - Rasterizer2D.defaultDrawingAreaSize(); - } + if (textColourEffect[defaultText] == 7) + i3 = anInt1265 % 20 >= 10 ? 65535 : 255; + if (textColourEffect[defaultText] == 8) + i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056; + if (textColourEffect[defaultText] == 9) { + int j3 = 150 - anIntArray982[defaultText]; + if (j3 < 50) + i3 = 0xff0000 + 1280 * j3; + else if (j3 < 100) + i3 = 0xffff00 - 0x50000 * (j3 - 50); + else if (j3 < 150) + i3 = 65280 + 5 * (j3 - 100); + } + if (textColourEffect[defaultText] == 10) { + int k3 = 150 - anIntArray982[defaultText]; + if (k3 < 50) + i3 = 0xff0000 + 5 * k3; + else if (k3 < 100) + i3 = 0xff00ff - 0x50000 * (k3 - 50); + else if (k3 < 150) + i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100); + } + if (textColourEffect[defaultText] == 11) { + int l3 = 150 - anIntArray982[defaultText]; + if (l3 < 50) + i3 = 0xffffff - 0x50005 * l3; + else if (l3 < 100) + i3 = 65280 + 0x50005 * (l3 - 50); + else if (l3 < 150) + i3 = 0xffffff - 0x50000 * (l3 - 100); + } + if (anIntArray981[defaultText] == 0) { + boldText.drawText(0, s, spriteDrawY + 1, spriteDrawX); + boldText.drawText(i3, s, spriteDrawY, spriteDrawX); + } + if (anIntArray981[defaultText] == 1) { + boldText.wave(0, s, spriteDrawX, anInt1265, spriteDrawY + 1); + boldText.wave(i3, s, spriteDrawX, anInt1265, spriteDrawY); + } + if (anIntArray981[defaultText] == 2) { + boldText.wave2(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0); + boldText.wave2(spriteDrawX, s, anInt1265, spriteDrawY, i3); + } + if (anIntArray981[defaultText] == 3) { + boldText.shake(150 - anIntArray982[defaultText], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0); + boldText.shake(150 - anIntArray982[defaultText], s, anInt1265, spriteDrawY, spriteDrawX, i3); + } + if (anIntArray981[defaultText] == 4) { + int i4 = boldText.method384(s); + int k4 = ((150 - anIntArray982[defaultText]) * (i4 + 100)) / 150; + Rasterizer2D.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0); + boldText.render(0, s, spriteDrawY + 1, (spriteDrawX + 50) - k4); + boldText.render(i3, s, spriteDrawY, (spriteDrawX + 50) - k4); + Rasterizer2D.defaultDrawingAreaSize(); + } + if (anIntArray981[defaultText] == 5) { + int j4 = 150 - anIntArray982[defaultText]; + int l4 = 0; + if (j4 < 25) + l4 = j4 - 25; + else if (j4 > 125) + l4 = j4 - 125; + Rasterizer2D.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - boldText.verticalSpace - 1); + boldText.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX); + boldText.drawText(i3, s, spriteDrawY + l4, spriteDrawX); + Rasterizer2D.defaultDrawingAreaSize(); + } } else { boldText.drawText(0, s, spriteDrawY + 1, spriteDrawX); boldText.drawText(0xffff00, s, spriteDrawY, spriteDrawX); @@ -2691,12 +2448,12 @@ else if (j4 > 125) public void drawSideIcons() { - // local variables will not stay in memory which will help with performance. - final int[] sideIconsX = - {17, 49, 83, 114, 146, 180, 214, 16, 49, 82, 116, 148, 184, 216}, - sideIconsY = {9, 7, 7, 5, 2, 3, 7, 303, 306, 306, 302, 305, 303, 303, 303}, - sideIconsId = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, - sideIconsTab = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; + // local variables will not stay in memory which will help with + // performance. + final int[] sideIconsX = { 17, 49, 83, 114, 146, 180, 214, 16, 49, 82, 116, 148, 184, 216 }, + sideIconsY = { 9, 7, 7, 5, 2, 3, 7, 303, 306, 306, 302, 305, 303, 303, 303 }, + sideIconsId = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }, + sideIconsTab = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247; int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336; @@ -2704,33 +2461,29 @@ public void drawSideIcons() { for (int i = 0; i < sideIconsTab.length; i++) { if (tabInterfaceIDs[sideIconsTab[i]] != -1) { if (sideIconsId[i] != -1) { - sideIcons[sideIconsId[i]].drawSprite(sideIconsX[i] + xOffset, - sideIconsY[i] + yOffset); + sideIcons[sideIconsId[i]].drawSprite(sideIconsX[i] + xOffset, sideIconsY[i] + yOffset); } } } } else if (changeTabArea && frameWidth < 1000) { - int[] iconId = {0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13}; - int[] iconX = {219, 189, 156, 126, 93, 62, 30, 219, 189, 156, 124, 92, 59, 28}; - int[] iconY = {67, 69, 67, 69, 72, 72, 69, 32, 29, 29, 32, 30, 33, 31, 32}; + int[] iconId = { 0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13 }; + int[] iconX = { 219, 189, 156, 126, 93, 62, 30, 219, 189, 156, 124, 92, 59, 28 }; + int[] iconY = { 67, 69, 67, 69, 72, 72, 69, 32, 29, 29, 32, 30, 33, 31, 32 }; for (int i = 0; i < sideIconsTab.length; i++) { if (tabInterfaceIDs[sideIconsTab[i]] != -1) { if (iconId[i] != -1) { - sideIcons[iconId[i]].drawSprite(frameWidth - iconX[i], - frameHeight - iconY[i]); + sideIcons[iconId[i]].drawSprite(frameWidth - iconX[i], frameHeight - iconY[i]); } } } } else if (changeTabArea && frameWidth >= 1000) { - int[] iconId = {0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13}; - int[] iconX = - {50, 80, 114, 143, 176, 208, 240, 242, 273, 306, 338, 370, 404, 433}; - int[] iconY = {30, 32, 30, 32, 34, 34, 32, 32, 29, 29, 32, 31, 32, 32, 32}; + int[] iconId = { 0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13 }; + int[] iconX = { 50, 80, 114, 143, 176, 208, 240, 242, 273, 306, 338, 370, 404, 433 }; + int[] iconY = { 30, 32, 30, 32, 34, 34, 32, 32, 29, 29, 32, 31, 32, 32, 32 }; for (int i = 0; i < sideIconsTab.length; i++) { if (tabInterfaceIDs[sideIconsTab[i]] != -1) { if (iconId[i] != -1) { - sideIcons[iconId[i]].drawSprite(frameWidth - 461 + iconX[i], - frameHeight - iconY[i]); + sideIcons[iconId[i]].drawSprite(frameWidth - 461 + iconX[i], frameHeight - iconY[i]); } } } @@ -2739,31 +2492,27 @@ public void drawSideIcons() { private void drawRedStones() { - final int[] redStonesX = - {6, 44, 77, 110, 143, 176, 209, 6, 44, 77, 110, 143, 176, 209}, - redStonesY = {0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298}, - redStonesId = {35, 39, 39, 39, 39, 39, 36, 37, 39, 39, 39, 39, 39, 38}; + final int[] redStonesX = { 6, 44, 77, 110, 143, 176, 209, 6, 44, 77, 110, 143, 176, 209 }, + redStonesY = { 0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298 }, + redStonesId = { 35, 39, 39, 39, 39, 39, 36, 37, 39, 39, 39, 39, 39, 38 }; int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247; int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336; if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) { if (tabInterfaceIDs[tabId] != -1 && tabId != 15) { - cacheSprite[redStonesId[tabId]].drawSprite(redStonesX[tabId] + xOffset, - redStonesY[tabId] + yOffset); + cacheSprite[redStonesId[tabId]].drawSprite(redStonesX[tabId] + xOffset, redStonesY[tabId] + yOffset); } } else if (changeTabArea && frameWidth < 1000) { - int[] stoneX = {226, 194, 162, 130, 99, 65, 34, 219, 195, 161, 130, 98, 65, 33}; - int[] stoneY = {73, 73, 73, 73, 73, 73, 73, -1, 37, 37, 37, 37, 37, 37, 37}; + int[] stoneX = { 226, 194, 162, 130, 99, 65, 34, 219, 195, 161, 130, 98, 65, 33 }; + int[] stoneY = { 73, 73, 73, 73, 73, 73, 73, -1, 37, 37, 37, 37, 37, 37, 37 }; if (tabInterfaceIDs[tabId] != -1 && tabId != 10 && showTabComponents) { if (tabId == 7) { cacheSprite[39].drawSprite(frameWidth - 130, frameHeight - 37); } - cacheSprite[39].drawSprite(frameWidth - stoneX[tabId], - frameHeight - stoneY[tabId]); + cacheSprite[39].drawSprite(frameWidth - stoneX[tabId], frameHeight - stoneY[tabId]); } } else if (changeTabArea && frameWidth >= 1000) { - int[] stoneX = - {417, 385, 353, 321, 289, 256, 224, 129, 193, 161, 130, 98, 65, 33}; + int[] stoneX = { 417, 385, 353, 321, 289, 256, 224, 129, 193, 161, 130, 98, 65, 33 }; if (tabInterfaceIDs[tabId] != -1 && tabId != 10 && showTabComponents) { cacheSprite[39].drawSprite(frameWidth - stoneX[tabId], frameHeight - 37); } @@ -2790,8 +2539,8 @@ private void drawTabArea() { transparentTabArea ? 80 : 256); cacheSprite[50].drawSprite(frameWidth - 204, frameHeight - 311); } - for (int x = frameWidth - 417, y = frameHeight - 37, index = - 0; x <= frameWidth - 30 && index < 13; x += 32, index++) { + for (int x = frameWidth - 417, y = frameHeight - 37, index = 0; x <= frameWidth - 30 + && index < 13; x += 32, index++) { cacheSprite[46].drawSprite(x, y); } } else if (frameWidth < 1000) { @@ -2800,12 +2549,12 @@ private void drawTabArea() { transparentTabArea ? 80 : 256); cacheSprite[50].drawSprite(frameWidth - 204, frameHeight - 348); } - for (int x = frameWidth - 226, y = frameHeight - 73, index = - 0; x <= frameWidth - 32 && index < 7; x += 32, index++) { + for (int x = frameWidth - 226, y = frameHeight - 73, index = 0; x <= frameWidth - 32 + && index < 7; x += 32, index++) { cacheSprite[46].drawSprite(x, y); } - for (int x = frameWidth - 226, y = frameHeight - 37, index = - 0; x <= frameWidth - 32 && index < 7; x += 32, index++) { + for (int x = frameWidth - 226, y = frameHeight - 37, index = 0; x <= frameWidth - 32 + && index < 7; x += 32, index++) { cacheSprite[46].drawSprite(x, y); } } @@ -2832,8 +2581,7 @@ private void drawTabArea() { } } if (menuOpen) { - drawMenu(frameMode == ScreenMode.FIXED ? 516 : 0, - frameMode == ScreenMode.FIXED ? 168 : 0); + drawMenu(frameMode == ScreenMode.FIXED ? 516 : 0, frameMode == ScreenMode.FIXED ? 168 : 0); } if (frameMode == ScreenMode.FIXED) { tabImageProducer.drawGraphics(168, super.graphics, 516); @@ -2859,22 +2607,20 @@ private void writeBackgroundTexture(int j) { anInt854++; if (anInt854 > 1235) { anInt854 = 0; - /*Anticheat? - outgoing.writeOpcode(226); - outgoing.writeByte(0); - int l2 = outgoing.currentPosition; - outgoing.writeShort(58722); - outgoing.writeByte(240); - outgoing.writeShort((int) (Math.random() * 65536D)); - outgoing.writeByte((int) (Math.random() * 256D)); - if ((int) (Math.random() * 2D) == 0) - outgoing.writeShort(51825); - outgoing.writeByte((int) (Math.random() * 256D)); - outgoing.writeShort((int) (Math.random() * 65536D)); - outgoing.writeShort(7130); - outgoing.writeShort((int) (Math.random() * 65536D)); - outgoing.writeShort(61657); - outgoing.writeBytes(outgoing.currentPosition - l2);*/ + /* + * Anticheat? outgoing.writeOpcode(226); + * outgoing.writeByte(0); int l2 = outgoing.currentPosition; + * outgoing.writeShort(58722); outgoing.writeByte(240); + * outgoing.writeShort((int) (Math.random() * 65536D)); + * outgoing.writeByte((int) (Math.random() * 256D)); if + * ((int) (Math.random() * 2D) == 0) + * outgoing.writeShort(51825); outgoing.writeByte((int) + * (Math.random() * 256D)); outgoing.writeShort((int) + * (Math.random() * 65536D)); outgoing.writeShort(7130); + * outgoing.writeShort((int) (Math.random() * 65536D)); + * outgoing.writeShort(61657); + * outgoing.writeBytes(outgoing.currentPosition - l2); + */ } } if (Rasterizer3D.textureLastUsed[24] >= j) { @@ -2992,12 +2738,14 @@ private void calculateCameraPosition() { if (l1 > 383) l1 = 383; if (yCameraCurve < l1) { - yCameraCurve += constCinematicCamRotationSpeed + ((l1 - yCameraCurve) * varCinematicCamRotationSpeedPromille) / 1000; + yCameraCurve += constCinematicCamRotationSpeed + + ((l1 - yCameraCurve) * varCinematicCamRotationSpeedPromille) / 1000; if (yCameraCurve > l1) yCameraCurve = l1; } if (yCameraCurve > l1) { - yCameraCurve -= constCinematicCamRotationSpeed + ((yCameraCurve - l1) * varCinematicCamRotationSpeedPromille) / 1000; + yCameraCurve -= constCinematicCamRotationSpeed + + ((yCameraCurve - l1) * varCinematicCamRotationSpeedPromille) / 1000; if (yCameraCurve < l1) yCameraCurve = l1; } @@ -3040,76 +2788,57 @@ public void drawMenu(int x, int y) { for (int i = 0; i < menuActionRow; i++) { int textY = yPos + 31 + (menuActionRow - 1 - i) * 15; int textColor = 0xffffff; - if (mouseX > xPos && mouseX < xPos + w && mouseY > textY - 13 - && mouseY < textY + 3) { + if (mouseX > xPos && mouseX < xPos + w && mouseY > textY - 13 && mouseY < textY + 3) { Rasterizer2D.drawBox(xPos + 3, textY - 11, menuWidth - 6, 15, 0x6f695d); textColor = 0xffff00; } - boldText.drawTextWithPotentialShadow(true, xPos + 3, textColor, menuActionText[i], - textY); + boldText.drawTextWithPotentialShadow(true, xPos + 3, textColor, menuActionText[i], textY); } } private void addFriend(long nameHash) { - //try { + // try { if (nameHash == 0L) return; - sendPacket(new AddFriend(nameHash)); - /*if (friendsCount >= 100 && member != 1) { - sendMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", - 0, ""); - return; - } - if (friendsCount >= 200) { - sendMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", - 0, ""); - return; - } - String s = StringUtils.formatText(StringUtils.decodeBase37(nameHash)); - for (int i = 0; i < friendsCount; i++) - if (friendsListAsLongs[i] == nameHash) { - sendMessage(s + " is already on your friend list", 0, ""); - return; - } - for (int j = 0; j < ignoreCount; j++) - if (ignoreListAsLongs[j] == nameHash) { - sendMessage("Please remove " + s + " from your ignore list first", 0, - ""); - return; - } - - if (s.equals(localPlayer.name)) { - return; - } else { - friendsList[friendsCount] = s; - friendsListAsLongs[friendsCount] = nameHash; - friendsNodeIDs[friendsCount] = 0; - friendsCount++; - sendPacket(new AddFriend(nameHash)); - return; - } - } catch (RuntimeException runtimeexception) { - SignLink.reporterror("15283, " + (byte) 68 + ", " + nameHash + ", " - + runtimeexception.toString()); - } - throw new RuntimeException();*/ + sendPacket(new AddFriend(nameHash)); + /* + * if (friendsCount >= 100 && member != 1) { + * sendMessage("Your friendlist is full. Max of 100 for free users, and 200 for members" + * , 0, ""); return; } if (friendsCount >= 200) { + * sendMessage("Your friendlist is full. Max of 100 for free users, and 200 for members" + * , 0, ""); return; } String s = + * StringUtils.formatText(StringUtils.decodeBase37(nameHash)); for (int + * i = 0; i < friendsCount; i++) if (friendsListAsLongs[i] == nameHash) + * { sendMessage(s + " is already on your friend list", 0, ""); return; + * } for (int j = 0; j < ignoreCount; j++) if (ignoreListAsLongs[j] == + * nameHash) { sendMessage("Please remove " + s + + * " from your ignore list first", 0, ""); return; } + * + * if (s.equals(localPlayer.name)) { return; } else { + * friendsList[friendsCount] = s; friendsListAsLongs[friendsCount] = + * nameHash; friendsNodeIDs[friendsCount] = 0; friendsCount++; + * sendPacket(new AddFriend(nameHash)); return; } } catch + * (RuntimeException runtimeexception) { SignLink.reporterror("15283, " + * + (byte) 68 + ", " + nameHash + ", " + runtimeexception.toString()); + * } throw new RuntimeException(); + */ } private int getCenterHeight(int z, int y, int x) { int worldX = x >> 7; - int worldY = y >> 7; - if (worldX < 0 || worldY < 0 || worldX > 103 || worldY > 103) - return 0; - int plane = z; - if (plane < 3 && (tileFlags[1][worldX][worldY] & 2) == 2) - plane++; - int sizeX = x & 0x7f; - int sizeY = y & 0x7f; - int i2 = tileHeights[plane][worldX][worldY] * (128 - sizeX) - + tileHeights[plane][worldX + 1][worldY] * sizeX >> 7; - int j2 = tileHeights[plane][worldX][worldY + 1] * (128 - sizeX) - + tileHeights[plane][worldX + 1][worldY + 1] * sizeX >> 7; - return i2 * (128 - sizeY) + j2 * sizeY >> 7; + int worldY = y >> 7; + if (worldX < 0 || worldY < 0 || worldX > 103 || worldY > 103) + return 0; + int plane = z; + if (plane < 3 && (tileFlags[1][worldX][worldY] & 2) == 2) + plane++; + int sizeX = x & 0x7f; + int sizeY = y & 0x7f; + int i2 = tileHeights[plane][worldX][worldY] * (128 - sizeX) + + tileHeights[plane][worldX + 1][worldY] * sizeX >> 7; + int j2 = tileHeights[plane][worldX][worldY + 1] * (128 - sizeX) + + tileHeights[plane][worldX + 1][worldY + 1] * sizeX >> 7; + return i2 * (128 - sizeY) + j2 * sizeY >> 7; } private static String intToKOrMil(int j) { @@ -3149,8 +2878,7 @@ private void changeCharacterGender() { for (int j = 0; j < 7; j++) { anIntArray1065[j] = -1; for (int k = 0; k < IdentityKit.length; k++) { - if (IdentityKit.kits[k].validStyle - || IdentityKit.kits[k].part != j + (maleCharacter ? 0 : 7)) + if (IdentityKit.kits[k].validStyle || IdentityKit.kits[k].part != j + (maleCharacter ? 0 : 7)) continue; anIntArray1065[j] = k; break; @@ -3191,6 +2919,7 @@ private void updateNPCMovement(int i, Buffer stream) { stream.disableBitAccess(); } + @Override public void processGameLoop() { if (rsAlreadyLoaded || loadingError || genericLoadingError) return; @@ -3206,11 +2935,11 @@ public void processGameLoop() { private void showPrioritizedPlayers() { showPlayer(localPlayer, internalLocalPlayerIndex << 14, true); - //Draw the player we're interacting with - //Interacting includes combat, following, etc. + // Draw the player we're interacting with + // Interacting includes combat, following, etc. int interact = localPlayer.interactingEntity - 32768; - if(interact > 0) { - Player player = players[interact]; + if (interact > 0) { + Player player = players[interact]; showPlayer(player, interact << 14, false); } } @@ -3220,13 +2949,13 @@ private void showOtherPlayers() { Player player = players[playerList[l]]; int index = playerList[l] << 14; - //Don't draw interacting player as we've already drawn it on top + // Don't draw interacting player as we've already drawn it on top int interact_index = (localPlayer.interactingEntity - 32768); - if(interact_index > 0 && index == interact_index << 14) { + if (interact_index > 0 && index == interact_index << 14) { continue; } - if(!showPlayer(player, index, false)) { + if (!showPlayer(player, index, false)) { continue; } } @@ -3236,27 +2965,31 @@ private boolean showPlayer(Player player, int i1, boolean flag) { if (player == null || !player.isVisible()) { return false; } - player.aBoolean1699 = (lowMemory && playerCount > 50 || playerCount > 200) && !flag && player.movementAnimation == player.idleAnimation; + player.aBoolean1699 = (lowMemory && playerCount > 50 || playerCount > 200) && !flag + && player.movementAnimation == player.idleAnimation; int j1 = player.x >> 7; - int k1 = player.y >> 7; - if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) { - return false; - } - if (player.playerModel != null && tick >= player.objectModelStart && tick < player.objectModelStop) { - player.aBoolean1699 = false; - player.anInt1709 = getCenterHeight(plane, player.y, player.x); - scene.addToScenePlayerAsObject(plane, player.y, player, player.orientation, player.objectAnInt1722GreaterYLoc, player.x, player.anInt1709, player.objectAnInt1719LesserXLoc, player.objectAnInt1721GreaterXLoc, i1, player.objectAnInt1720LesserYLoc); + int k1 = player.y >> 7; + if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) { + return false; + } + if (player.playerModel != null && tick >= player.objectModelStart && tick < player.objectModelStop) { + player.aBoolean1699 = false; + player.anInt1709 = getCenterHeight(plane, player.y, player.x); + scene.addToScenePlayerAsObject(plane, player.y, player, player.orientation, + player.objectAnInt1722GreaterYLoc, player.x, player.anInt1709, player.objectAnInt1719LesserXLoc, + player.objectAnInt1721GreaterXLoc, i1, player.objectAnInt1720LesserYLoc); + return false; + } + if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) { + if (anIntArrayArray929[j1][k1] == anInt1265) { return false; } - if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) { - if (anIntArrayArray929[j1][k1] == anInt1265) { - return false; - } - anIntArrayArray929[j1][k1] = anInt1265; - } - player.anInt1709 = getCenterHeight(plane, player.y, player.x); - scene.addAnimableA(plane, player.orientation, player.anInt1709, i1, player.y, 60, player.x, player, player.animationStretches); - return true; + anIntArrayArray929[j1][k1] = anInt1265; + } + player.anInt1709 = getCenterHeight(plane, player.y, player.x); + scene.addAnimableA(plane, player.orientation, player.anInt1709, i1, player.y, 60, player.x, player, + player.animationStretches); + return true; } private void showPlayers(int j) { @@ -3276,32 +3009,32 @@ private void showPlayers(int j) { if (player == null || !player.isVisible()) continue; - player.aBoolean1699 = (lowMemory && playerCount > 50 || playerCount > 200) && j != 1 && player.movementAnimation == player.idleAnimation; + player.aBoolean1699 = (lowMemory && playerCount > 50 || playerCount > 200) && j != 1 + && player.movementAnimation == player.idleAnimation; int j1 = player.x >> 7; - int k1 = player.y >> 7; - if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) - continue; - if (player.playerModel != null && tick >= player.objectModelStart - && tick < player.objectModelStop) { - player.aBoolean1699 = false; - player.anInt1709 = getCenterHeight(plane, player.y, player.x); - scene.addToScenePlayerAsObject(plane, player.y, player, player.orientation, player.objectAnInt1722GreaterYLoc, - player.x, player.anInt1709, player.objectAnInt1719LesserXLoc, player.objectAnInt1721GreaterXLoc, - i1, player.objectAnInt1720LesserYLoc); - continue; - } - if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) { - if (anIntArrayArray929[j1][k1] == anInt1265) + int k1 = player.y >> 7; + if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) continue; - anIntArrayArray929[j1][k1] = anInt1265; - } - player.anInt1709 = getCenterHeight(plane, player.y, player.x); - scene.addAnimableA(plane, player.orientation, player.anInt1709, i1, player.y, 60, - player.x, player, player.animationStretches); + if (player.playerModel != null && tick >= player.objectModelStart && tick < player.objectModelStop) { + player.aBoolean1699 = false; + player.anInt1709 = getCenterHeight(plane, player.y, player.x); + scene.addToScenePlayerAsObject(plane, player.y, player, player.orientation, + player.objectAnInt1722GreaterYLoc, player.x, player.anInt1709, player.objectAnInt1719LesserXLoc, + player.objectAnInt1721GreaterXLoc, i1, player.objectAnInt1720LesserYLoc); + continue; + } + if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) { + if (anIntArrayArray929[j1][k1] == anInt1265) + continue; + anIntArrayArray929[j1][k1] = anInt1265; + } + player.anInt1709 = getCenterHeight(plane, player.y, player.x); + scene.addAnimableA(plane, player.orientation, player.anInt1709, i1, player.y, 60, player.x, player, + player.animationStretches); } } - private boolean promptUserForInput(Widget widget) { + private boolean promptUserForInput(Widget widget) { int contentType = widget.contentType; if (friendServerStatus == 2) { if (contentType == 201) { @@ -3359,8 +3092,7 @@ private boolean promptUserForInput(Widget widget) { i2 = IdentityKit.length - 1; if (j1 == 1 && ++i2 >= IdentityKit.length) i2 = 0; - } while (IdentityKit.kits[i2].validStyle - || IdentityKit.kits[i2].part != k + (maleCharacter ? 0 : 7)); + } while (IdentityKit.kits[i2].validStyle || IdentityKit.kits[i2].part != k + (maleCharacter ? 0 : 7)); anIntArray1065[k] = i2; aBoolean1031 = true; } @@ -3396,18 +3128,20 @@ private boolean promptUserForInput(Widget widget) { if (contentType >= 601 && contentType <= 612) { clearTopInterfaces(); if (reportAbuseInput.length() > 0) { - /* outgoing.writeOpcode(PacketConstants.REPORT_PLAYER); - outgoing.writeLong(StringUtils.encodeBase37(reportAbuseInput)); - outgoing.writeByte(contentType - 601); - outgoing.writeByte(canMute ? 1 : 0);*/ + /* + * outgoing.writeOpcode(PacketConstants.REPORT_PLAYER); + * outgoing.writeLong(StringUtils.encodeBase37(reportAbuseInput) + * ); outgoing.writeByte(contentType - 601); + * outgoing.writeByte(canMute ? 1 : 0); + */ } } return false; } - private void parsePlayerSynchronizationMask(Buffer stream) { - for (int count = 0; count < mobsAwaitingUpdateCount; count++) { - int index = mobsAwaitingUpdate[count]; + private void parsePlayerSynchronizationMask(Buffer stream) { + for (int count = 0; count < mobsAwaitingUpdateCount; count++) { + int index = mobsAwaitingUpdate[count]; Player player = players[index]; int mask = stream.readUnsignedByte(); @@ -3416,7 +3150,7 @@ private void parsePlayerSynchronizationMask(Buffer stream) { mask += stream.readUnsignedByte() << 8; } - appendPlayerUpdateMask(mask, index, stream, player); + appendPlayerUpdateMask(mask, index, stream, player); } } @@ -3425,111 +3159,109 @@ private void drawMapScenes(int i, int k, int l, int i1, int j1) { if (k1 != 0) { int l1 = scene.getMask(j1, l, i, k1); int k2 = l1 >> 6 & 3; - int i3 = l1 & 0x1f; - int k3 = k; - if (k1 > 0) - k3 = i1; - int ai[] = minimapImage.myPixels; - int k4 = 24624 + l * 4 + (103 - i) * 512 * 4; - int i5 = k1 >> 14 & 0x7fff; - ObjectDefinition def = ObjectDefinition.lookup(i5); - if (def.mapscene != -1) { - IndexedImage background_2 = mapScenes[def.mapscene]; - if (background_2 != null) { - int i6 = (def.objectSizeX * 4 - background_2.width) / 2; - int j6 = (def.objectSizeY * 4 - background_2.height) / 2; - background_2.draw(48 + l * 4 + i6, - 48 + (104 - i - def.objectSizeY) * 4 + j6); - } - } else { - if (i3 == 0 || i3 == 2) - if (k2 == 0) { - ai[k4] = k3; - ai[k4 + 512] = k3; - ai[k4 + 1024] = k3; - ai[k4 + 1536] = k3; - } else if (k2 == 1) { - ai[k4] = k3; - ai[k4 + 1] = k3; - ai[k4 + 2] = k3; - ai[k4 + 3] = k3; - } else if (k2 == 2) { - ai[k4 + 3] = k3; - ai[k4 + 3 + 512] = k3; - ai[k4 + 3 + 1024] = k3; - ai[k4 + 3 + 1536] = k3; - } else if (k2 == 3) { - ai[k4 + 1536] = k3; - ai[k4 + 1536 + 1] = k3; - ai[k4 + 1536 + 2] = k3; - ai[k4 + 1536 + 3] = k3; - } - if (i3 == 3) - if (k2 == 0) - ai[k4] = k3; - else if (k2 == 1) - ai[k4 + 3] = k3; - else if (k2 == 2) - ai[k4 + 3 + 1536] = k3; - else if (k2 == 3) - ai[k4 + 1536] = k3; - if (i3 == 2) - if (k2 == 3) { - ai[k4] = k3; - ai[k4 + 512] = k3; - ai[k4 + 1024] = k3; - ai[k4 + 1536] = k3; - } else if (k2 == 0) { - ai[k4] = k3; - ai[k4 + 1] = k3; - ai[k4 + 2] = k3; - ai[k4 + 3] = k3; - } else if (k2 == 1) { - ai[k4 + 3] = k3; - ai[k4 + 3 + 512] = k3; - ai[k4 + 3 + 1024] = k3; - ai[k4 + 3 + 1536] = k3; - } else if (k2 == 2) { - ai[k4 + 1536] = k3; - ai[k4 + 1536 + 1] = k3; - ai[k4 + 1536 + 2] = k3; - ai[k4 + 1536 + 3] = k3; - } - } + int i3 = l1 & 0x1f; + int k3 = k; + if (k1 > 0) + k3 = i1; + int ai[] = minimapImage.myPixels; + int k4 = 24624 + l * 4 + (103 - i) * 512 * 4; + int i5 = k1 >> 14 & 0x7fff; + ObjectDefinition def = ObjectDefinition.lookup(i5); + if (def.mapscene != -1) { + IndexedImage background_2 = mapScenes[def.mapscene]; + if (background_2 != null) { + int i6 = (def.objectSizeX * 4 - background_2.width) / 2; + int j6 = (def.objectSizeY * 4 - background_2.height) / 2; + background_2.draw(48 + l * 4 + i6, 48 + (104 - i - def.objectSizeY) * 4 + j6); + } + } else { + if (i3 == 0 || i3 == 2) + if (k2 == 0) { + ai[k4] = k3; + ai[k4 + 512] = k3; + ai[k4 + 1024] = k3; + ai[k4 + 1536] = k3; + } else if (k2 == 1) { + ai[k4] = k3; + ai[k4 + 1] = k3; + ai[k4 + 2] = k3; + ai[k4 + 3] = k3; + } else if (k2 == 2) { + ai[k4 + 3] = k3; + ai[k4 + 3 + 512] = k3; + ai[k4 + 3 + 1024] = k3; + ai[k4 + 3 + 1536] = k3; + } else if (k2 == 3) { + ai[k4 + 1536] = k3; + ai[k4 + 1536 + 1] = k3; + ai[k4 + 1536 + 2] = k3; + ai[k4 + 1536 + 3] = k3; + } + if (i3 == 3) + if (k2 == 0) + ai[k4] = k3; + else if (k2 == 1) + ai[k4 + 3] = k3; + else if (k2 == 2) + ai[k4 + 3 + 1536] = k3; + else if (k2 == 3) + ai[k4 + 1536] = k3; + if (i3 == 2) + if (k2 == 3) { + ai[k4] = k3; + ai[k4 + 512] = k3; + ai[k4 + 1024] = k3; + ai[k4 + 1536] = k3; + } else if (k2 == 0) { + ai[k4] = k3; + ai[k4 + 1] = k3; + ai[k4 + 2] = k3; + ai[k4 + 3] = k3; + } else if (k2 == 1) { + ai[k4 + 3] = k3; + ai[k4 + 3 + 512] = k3; + ai[k4 + 3 + 1024] = k3; + ai[k4 + 3 + 1536] = k3; + } else if (k2 == 2) { + ai[k4 + 1536] = k3; + ai[k4 + 1536 + 1] = k3; + ai[k4 + 1536 + 2] = k3; + ai[k4 + 1536 + 3] = k3; + } + } } k1 = scene.getGameObjectUid(j1, l, i); if (k1 != 0) { int i2 = scene.getMask(j1, l, i, k1); int l2 = i2 >> 6 & 3; - int j3 = i2 & 0x1f; - int l3 = k1 >> 14 & 0x7fff; - ObjectDefinition class46_1 = ObjectDefinition.lookup(l3); - if (class46_1.mapscene != -1) { - IndexedImage background_1 = mapScenes[class46_1.mapscene]; - if (background_1 != null) { - int j5 = (class46_1.objectSizeX * 4 - background_1.width) / 2; - int k5 = (class46_1.objectSizeY * 4 - background_1.height) / 2; - background_1.draw(48 + l * 4 + j5, - 48 + (104 - i - class46_1.objectSizeY) * 4 + k5); - } - } else if (j3 == 9) { - int l4 = 0xeeeeee; - if (k1 > 0) - l4 = 0xee0000; - int ai1[] = minimapImage.myPixels; - int l5 = 24624 + l * 4 + (103 - i) * 512 * 4; - if (l2 == 0 || l2 == 2) { - ai1[l5 + 1536] = l4; - ai1[l5 + 1024 + 1] = l4; - ai1[l5 + 512 + 2] = l4; - ai1[l5 + 3] = l4; - } else { - ai1[l5] = l4; - ai1[l5 + 512 + 1] = l4; - ai1[l5 + 1024 + 2] = l4; - ai1[l5 + 1536 + 3] = l4; - } - } + int j3 = i2 & 0x1f; + int l3 = k1 >> 14 & 0x7fff; + ObjectDefinition class46_1 = ObjectDefinition.lookup(l3); + if (class46_1.mapscene != -1) { + IndexedImage background_1 = mapScenes[class46_1.mapscene]; + if (background_1 != null) { + int j5 = (class46_1.objectSizeX * 4 - background_1.width) / 2; + int k5 = (class46_1.objectSizeY * 4 - background_1.height) / 2; + background_1.draw(48 + l * 4 + j5, 48 + (104 - i - class46_1.objectSizeY) * 4 + k5); + } + } else if (j3 == 9) { + int l4 = 0xeeeeee; + if (k1 > 0) + l4 = 0xee0000; + int ai1[] = minimapImage.myPixels; + int l5 = 24624 + l * 4 + (103 - i) * 512 * 4; + if (l2 == 0 || l2 == 2) { + ai1[l5 + 1536] = l4; + ai1[l5 + 1024 + 1] = l4; + ai1[l5 + 512 + 2] = l4; + ai1[l5 + 3] = l4; + } else { + ai1[l5] = l4; + ai1[l5 + 512 + 1] = l4; + ai1[l5 + 1024 + 2] = l4; + ai1[l5 + 1536 + 3] = l4; + } + } } k1 = scene.getGroundDecorationUid(j1, l, i); if (k1 != 0) { @@ -3540,43 +3272,40 @@ else if (k2 == 3) if (background != null) { int i4 = (class46.objectSizeX * 4 - background.width) / 2; int j4 = (class46.objectSizeY * 4 - background.height) / 2; - background.draw(48 + l * 4 + i4, - 48 + (104 - i - class46.objectSizeY) * 4 + j4); + background.draw(48 + l * 4 + i4, 48 + (104 - i - class46.objectSizeY) * 4 + j4); } } } } private void loadTitleScreen() { - titleBoxIndexedImage = new IndexedImage(titleArchive, "titlebox", 0); - titleButtonIndexedImage = new IndexedImage(titleArchive, "titlebutton", 0); + titleBoxIndexedImage = new IndexedImage(titleArchive, "titlebox", 0); + titleButtonIndexedImage = new IndexedImage(titleArchive, "titlebutton", 0); - titleIndexedImages = new IndexedImage[12]; + titleIndexedImages = new IndexedImage[12]; int icon = 0; try { - icon = Integer.parseInt(getParameter("fl_icon")); + icon = Integer.parseInt(getParameter("fl_icon")); } catch (Exception ex) { } if (icon == 0) { - for (int index = 0; index < 12; index++) { + for (int index = 0; index < 12; index++) { titleIndexedImages[index] = new IndexedImage(titleArchive, "runes", index); } } else { - for (int index = 0; index < 12; index++) { + for (int index = 0; index < 12; index++) { titleIndexedImages[index] = new IndexedImage(titleArchive, "runes", 12 + (index & 3)); } } - flameLeftSprite = new Sprite(128, 265); + flameLeftSprite = new Sprite(128, 265); flameRightSprite = new Sprite(128, 265); - System.arraycopy(flameLeftBackground.canvasRaster, 0, - flameLeftSprite.myPixels, 0, 33920); + System.arraycopy(flameLeftBackground.canvasRaster, 0, flameLeftSprite.myPixels, 0, 33920); - System.arraycopy(flameRightBackground.canvasRaster, 0, - flameRightSprite.myPixels, 0, 33920); + System.arraycopy(flameRightBackground.canvasRaster, 0, flameRightSprite.myPixels, 0, 33920); anIntArray851 = new int[256]; @@ -3662,18 +3391,16 @@ private void loadingStages() { if (lowMemory && loadingStage == 2 && MapRegion.anInt131 != plane) { gameScreenImageProducer.initDrawingArea(); drawLoadingMessages(1, "Loading - please wait.", null); - gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, - super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0); + gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, + frameMode == ScreenMode.FIXED ? 4 : 0); loadingStage = 1; loadingStartTime = System.currentTimeMillis(); } if (loadingStage == 1) { int j = getMapLoadingState(); if (j != 0 && System.currentTimeMillis() - loadingStartTime > 0x57e40L) { - SignLink.reporterror(myUsername + " glcfb " + serverSeed + "," + j + "," - + lowMemory + "," + indices[0] + "," - + resourceProvider.remaining() + "," + plane + "," + this.regionX - + "," + this.regionY); + SignLink.reporterror(myUsername + " glcfb " + serverSeed + "," + j + "," + lowMemory + "," + indices[0] + + "," + resourceProvider.remaining() + "," + plane + "," + this.regionX + "," + this.regionY); loadingStartTime = System.currentTimeMillis(); } } @@ -3725,20 +3452,17 @@ private int getMapLoadingState() { private void createProjectiles() { for (Projectile class30_sub2_sub4_sub4 = (Projectile) projectiles - .reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = - (Projectile) projectiles.reverseGetNext()) - if (class30_sub2_sub4_sub4.projectileZ != plane - || tick > class30_sub2_sub4_sub4.stopCycle) + .reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Projectile) projectiles + .reverseGetNext()) + if (class30_sub2_sub4_sub4.projectileZ != plane || tick > class30_sub2_sub4_sub4.stopCycle) class30_sub2_sub4_sub4.unlink(); else if (tick >= class30_sub2_sub4_sub4.startCycle) { if (class30_sub2_sub4_sub4.target > 0) { Npc npc = npcs[class30_sub2_sub4_sub4.target - 1]; - if (npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 - && npc.y < 13312) + if (npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312) class30_sub2_sub4_sub4.calculateIncrements(tick, npc.y, - getCenterHeight(class30_sub2_sub4_sub4.projectileZ, npc.y, - npc.x) - - class30_sub2_sub4_sub4.endHeight, + getCenterHeight(class30_sub2_sub4_sub4.projectileZ, npc.y, npc.x) + - class30_sub2_sub4_sub4.endHeight, npc.x); } if (class30_sub2_sub4_sub4.target < 0) { @@ -3748,24 +3472,21 @@ else if (tick >= class30_sub2_sub4_sub4.startCycle) { player = localPlayer; else player = players[j]; - if (player != null && player.x >= 0 && player.x < 13312 - && player.y >= 0 && player.y < 13312) + if (player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312) class30_sub2_sub4_sub4.calculateIncrements(tick, player.y, - getCenterHeight(class30_sub2_sub4_sub4.projectileZ, player.y, - player.x) - - class30_sub2_sub4_sub4.endHeight, + getCenterHeight(class30_sub2_sub4_sub4.projectileZ, player.y, player.x) + - class30_sub2_sub4_sub4.endHeight, player.x); } class30_sub2_sub4_sub4.progressCycles(tickDelta); - scene.addAnimableA(plane, class30_sub2_sub4_sub4.turnValue, - (int) class30_sub2_sub4_sub4.cnterHeight, -1, - (int) class30_sub2_sub4_sub4.yPos, 60, - (int) class30_sub2_sub4_sub4.xPos, + scene.addAnimableA(plane, class30_sub2_sub4_sub4.turnValue, (int) class30_sub2_sub4_sub4.cnterHeight, + -1, (int) class30_sub2_sub4_sub4.yPos, 60, (int) class30_sub2_sub4_sub4.xPos, class30_sub2_sub4_sub4, false); } } + @Override public AppletContext getAppletContext() { if (SignLink.mainapp != null) return SignLink.mainapp.getAppletContext(); @@ -3847,8 +3568,7 @@ private void processOnDemandQueue() { if (resource.dataType == 1) { Frame.load(resource.ID, resource.buffer); } - if (resource.dataType == 2 && resource.ID == nextSong - && resource.buffer != null) + if (resource.dataType == 2 && resource.ID == nextSong && resource.buffer != null) saveMidi(fadeMusic, resource.buffer); if (resource.dataType == 3 && loadingStage == 1) { for (int i = 0; i < localRegionMapData.length; i++) { @@ -3867,8 +3587,7 @@ private void processOnDemandQueue() { } } - } while (resource.dataType != 93 - || !resourceProvider.landscapePresent(resource.ID)); + } while (resource.dataType != 93 || !resourceProvider.landscapePresent(resource.ID)); MapRegion.passiveRequestGameObjectModels(new Buffer(resource.buffer), resourceProvider); } while (true); } @@ -3890,8 +3609,8 @@ private void calcFlamesPosition() { for (int j1 = 1; j1 < c - 1; j1++) { for (int l1 = 1; l1 < 127; l1++) { int l2 = l1 + (j1 << 7); - anIntArray829[l2] = (anIntArray828[l2 - 1] + anIntArray828[l2 + 1] - + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4; + anIntArray829[l2] = (anIntArray828[l2 - 1] + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + + anIntArray828[l2 + 128]) / 4; } } @@ -3905,9 +3624,7 @@ private void calcFlamesPosition() { for (int j2 = 1; j2 < c - 1; j2++) { for (int i3 = 1; i3 < 127; i3++) { int k3 = i3 + (j2 << 7); - int i4 = anIntArray829[k3 + 128] - - anIntArray1190[k3 + anInt1275 & anIntArray1190.length - 1] - / 5; + int i4 = anIntArray829[k3 + 128] - anIntArray1190[k3 + anInt1275 & anIntArray1190.length - 1] / 5; if (i4 < 0) i4 = 0; anIntArray828[k3] = i4; @@ -3917,9 +3634,8 @@ private void calcFlamesPosition() { System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1); - anIntArray969[c - 1] = (int) (Math.sin((double) tick / 14D) * 16D - + Math.sin((double) tick / 15D) * 14D - + Math.sin((double) tick / 16D) * 12D); + anIntArray969[c + - 1] = (int) (Math.sin(tick / 14D) * 16D + Math.sin(tick / 15D) * 14D + Math.sin(tick / 16D) * 12D); if (anInt1040 > 0) anInt1040 -= 4; if (anInt1041 > 0) @@ -3935,7 +3651,7 @@ private void calcFlamesPosition() { private void resetAnimation(int i) { Widget class9 = Widget.interfaceCache[i]; - if(class9 == null || class9.children == null) { + if (class9 == null || class9.children == null) { return; } for (int j = 0; j < class9.children.length; j++) { @@ -3980,71 +3696,41 @@ private void mainGameProcessor() { if (flagged) { if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) { // botting - /* outgoing.writeOpcode(PacketConstants.FLAG_ACCOUNT); - outgoing.writeByte(0); - int j2 = outgoing.currentPosition; - int j3 = 0; - for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) { - if (j2 - outgoing.currentPosition >= 240) - break; - j3++; - int l4 = mouseDetection.coordsY[j4]; - if (l4 < 0) - l4 = 0; - else if (l4 > 502) - l4 = 502; - int k5 = mouseDetection.coordsX[j4]; - if (k5 < 0) - k5 = 0; - else if (k5 > 764) - k5 = 764; - int i6 = l4 * 765 + k5; - if (mouseDetection.coordsY[j4] == -1 - && mouseDetection.coordsX[j4] == -1) { - k5 = -1; - l4 = -1; - i6 = 0x7ffff; - } - if (k5 == anInt1237 && l4 == anInt1238) { - if (duplicateClickCount < 2047) - duplicateClickCount++; - } else { - int j6 = k5 - anInt1237; - anInt1237 = k5; - int k6 = l4 - anInt1238; - anInt1238 = l4; - if (duplicateClickCount < 8 && j6 >= -32 && j6 <= 31 - && k6 >= -32 && k6 <= 31) { - j6 += 32; - k6 += 32; - outgoing.writeShort((duplicateClickCount << 12) - + (j6 << 6) + k6); - duplicateClickCount = 0; - } else if (duplicateClickCount < 8) { - outgoing.writeTriByte(0x800000 - + (duplicateClickCount << 19) + i6); - duplicateClickCount = 0; - } else { - outgoing.writeInt(0xc0000000 - + (duplicateClickCount << 19) + i6); - duplicateClickCount = 0; - } - } - } - - outgoing.writeBytes(outgoing.currentPosition - j2); - if (j3 >= mouseDetection.coordsIndex) { - mouseDetection.coordsIndex = 0; - } else { - mouseDetection.coordsIndex -= j3; - for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) { - mouseDetection.coordsX[i5] = - mouseDetection.coordsX[i5 + j3]; - mouseDetection.coordsY[i5] = - mouseDetection.coordsY[i5 + j3]; - } - - }*/ + /* + * outgoing.writeOpcode(PacketConstants.FLAG_ACCOUNT); + * outgoing.writeByte(0); int j2 = outgoing.currentPosition; + * int j3 = 0; for (int j4 = 0; j4 < + * mouseDetection.coordsIndex; j4++) { if (j2 - + * outgoing.currentPosition >= 240) break; j3++; int l4 = + * mouseDetection.coordsY[j4]; if (l4 < 0) l4 = 0; else if + * (l4 > 502) l4 = 502; int k5 = mouseDetection.coordsX[j4]; + * if (k5 < 0) k5 = 0; else if (k5 > 764) k5 = 764; int i6 = + * l4 * 765 + k5; if (mouseDetection.coordsY[j4] == -1 && + * mouseDetection.coordsX[j4] == -1) { k5 = -1; l4 = -1; i6 + * = 0x7ffff; } if (k5 == anInt1237 && l4 == anInt1238) { if + * (duplicateClickCount < 2047) duplicateClickCount++; } + * else { int j6 = k5 - anInt1237; anInt1237 = k5; int k6 = + * l4 - anInt1238; anInt1238 = l4; if (duplicateClickCount < + * 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31) { j6 + * += 32; k6 += 32; outgoing.writeShort((duplicateClickCount + * << 12) + (j6 << 6) + k6); duplicateClickCount = 0; } else + * if (duplicateClickCount < 8) { + * outgoing.writeTriByte(0x800000 + (duplicateClickCount << + * 19) + i6); duplicateClickCount = 0; } else { + * outgoing.writeInt(0xc0000000 + (duplicateClickCount << + * 19) + i6); duplicateClickCount = 0; } } } + * + * outgoing.writeBytes(outgoing.currentPosition - j2); if + * (j3 >= mouseDetection.coordsIndex) { + * mouseDetection.coordsIndex = 0; } else { + * mouseDetection.coordsIndex -= j3; for (int i5 = 0; i5 < + * mouseDetection.coordsIndex; i5++) { + * mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + + * j3]; mouseDetection.coordsY[i5] = + * mouseDetection.coordsY[i5 + j3]; } + * + * } + */ } } else { mouseDetection.coordsIndex = 0; @@ -4070,42 +3756,45 @@ else if (k3 > 764) if (super.clickMode3 == 2) j5 = 1; int l5 = (int) l; - /* outgoing.writeOpcode(PacketConstants.MOUSE_CLICK); - outgoing.writeInt((l5 << 20) + (j5 << 19) + k4);*/ + /* + * outgoing.writeOpcode(PacketConstants.MOUSE_CLICK); + * outgoing.writeInt((l5 << 20) + (j5 << 19) + k4); + */ } if (anInt1016 > 0) { anInt1016--; } - if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 - || super.keyArray[4] == 1) + if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1) aBoolean1017 = true; if (aBoolean1017 && anInt1016 <= 0) { anInt1016 = 20; aBoolean1017 = false; - /* outgoing.writeOpcode(PacketConstants.CAMERA_MOVEMENT); - outgoing.writeShort(anInt1184); - outgoing.writeShortA(cameraHorizontal);*/ + /* + * outgoing.writeOpcode(PacketConstants.CAMERA_MOVEMENT); + * outgoing.writeShort(anInt1184); + * outgoing.writeShortA(cameraHorizontal); + */ } if (super.awtFocus && !aBoolean954) { aBoolean954 = true; - // sendPacket(new ClientFocused(false)); + // sendPacket(new ClientFocused(false)); } if (!super.awtFocus && aBoolean954) { aBoolean954 = false; - // sendPacket(new ClientFocused(false)); + // sendPacket(new ClientFocused(false)); } loadingStages(); method115(); timeoutCounter++; if (timeoutCounter > 750) dropClient(); - processPlayerMovement(); - processNpcMovement(); + processPlayerMovement(); + processNpcMovement(); processTrackUpdates(); - processMobChatText(); - tickDelta++; + processMobChatText(); + tickDelta++; if (crossType != 0) { crossIndex += 20; if (crossIndex >= 400) @@ -4123,8 +3812,8 @@ else if (k3 > 764) } if (activeInterfaceType != 0) { anInt989++; - if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 - || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5) + if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 + || super.mouseY < anInt1088 - 5) aBoolean1242 = true; if (super.clickMode2 == 0) { if (activeInterfaceType == 2) { @@ -4136,9 +3825,8 @@ else if (k3 > 764) bankItemDragSprite = null; lastActiveInvInterface = -1; processRightClick(); - if(!createBankTab()) { - if (lastActiveInvInterface == anInt1084 - && mouseInvInterfaceIndex != anInt1085) { + if (!createBankTab()) { + if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085) { Widget childInterface = Widget.interfaceCache[anInt1084]; int j1 = 0; if (anInt913 == 1 && childInterface.contentType == 206) @@ -4148,10 +3836,8 @@ else if (k3 > 764) if (childInterface.replaceItems) { int l2 = anInt1085; int l3 = mouseInvInterfaceIndex; - childInterface.inventoryItemId[l3] = - childInterface.inventoryItemId[l2]; - childInterface.inventoryAmounts[l3] = - childInterface.inventoryAmounts[l2]; + childInterface.inventoryItemId[l3] = childInterface.inventoryItemId[l2]; + childInterface.inventoryAmounts[l3] = childInterface.inventoryAmounts[l2]; childInterface.inventoryItemId[l2] = -1; childInterface.inventoryAmounts[l2] = 0; } else if (j1 == 1) { @@ -4166,15 +3852,13 @@ else if (k3 > 764) } } else { - childInterface.swapInventoryItems(anInt1085, - mouseInvInterfaceIndex); + childInterface.swapInventoryItems(anInt1085, mouseInvInterfaceIndex); } sendPacket(new SwitchItemSlot(anInt1084, j1, anInt1085, mouseInvInterfaceIndex)); - } + } } - } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) - && menuActionRow > 2) + } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) determineMenuSize(); else if (menuActionRow > 0) processMenuActions(menuActionRow - 1); @@ -4185,8 +3869,7 @@ else if (menuActionRow > 0) if (SceneGraph.clickedTileX != -1) { int k = SceneGraph.clickedTileX; int k1 = SceneGraph.clickedTileY; - boolean flag = doWalkTo(0, 0, 0, 0, localPlayer.pathY[0], 0, 0, k1, - localPlayer.pathX[0], true, k); + boolean flag = doWalkTo(0, 0, 0, 0, localPlayer.pathY[0], 0, 0, k1, localPlayer.pathX[0], true, k); SceneGraph.clickedTileX = -1; if (flag) { crossX = super.saveClickX; @@ -4217,21 +3900,21 @@ else if (menuActionRow > 0) } else if (anInt1501 > 0) { anInt1501--; } - if (loadingStage == 2) + if (loadingStage == 2) { checkForGameUsages(); - if (loadingStage == 2 && oriented) + } + if (loadingStage == 2 && oriented) { calculateCameraPosition(); - for (int i1 = 0; i1 < 5; i1++) + } + for (int i1 = 0; i1 < 5; i1++) { quakeTimes[i1]++; - + } manageTextInputs(); - if (super.idleTime++ > 9000) { anInt1011 = 250; super.idleTime = 0; sendPacket(new PlayerInactive()); } - if (ping_packet_counter++ > 50) { sendPacket(new BasicPing()); } @@ -4287,6 +3970,7 @@ private void setupLoginScreen() { welcomeScreenRaised = true; } + @Override public void drawLoadingText(int i, String s) { anInt1079 = i; aString1049 = s; @@ -4299,8 +3983,8 @@ public void drawLoadingText(int i, String s) { char c = '\u0168'; char c1 = '\310'; byte byte1 = 20; - boldText.drawText(0xffffff, Configuration.CLIENT_NAME + " is loading - please wait...", - c1 / 2 - 26 - byte1, c / 2); + boldText.drawText(0xffffff, Configuration.CLIENT_NAME + " is loading - please wait...", c1 / 2 - 26 - byte1, + c / 2); int j = c1 / 2 - 18 - byte1; Rasterizer2D.drawBoxOutline(c / 2 - 152, j, 304, 34, 0x8c1111); Rasterizer2D.drawBoxOutline(c / 2 - 151, j + 1, 302, 32, 0); @@ -4324,8 +4008,7 @@ public void drawLoadingText(int i, String s) { } } - private void method65(int i, int j, int k, int l, Widget class9, int i1, boolean flag, - int j1) { + private void method65(int i, int j, int k, int l, Widget class9, int i1, boolean flag, int j1) { int anInt992; if (aBoolean972) anInt992 = 32; @@ -4340,8 +4023,7 @@ private void method65(int i, int j, int k, int l, Widget class9, int i1, boolean class9.scrollPosition += anInt1213 * 4; if (flag) { } - } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 - && l < (i1 + j) - 16 && anInt1213 > 0) { + } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < (i1 + j) - 16 && anInt1213 > 0) { int l1 = ((j - 32) * j) / j1; if (l1 < 8) l1 = 8; @@ -4356,36 +4038,34 @@ private void method65(int i, int j, int k, int l, Widget class9, int i1, boolean private boolean clickObject(int i, int j, int k) { int i1 = i >> 14 & 0x7fff; - int j1 = scene.getMask(plane, k, j, i); - if (j1 == -1) - return false; - int k1 = j1 & 0x1f; - int l1 = j1 >> 6 & 3; - if (k1 == 10 || k1 == 11 || k1 == 22) { - ObjectDefinition class46 = ObjectDefinition.lookup(i1); - int i2; - int j2; - if (l1 == 0 || l1 == 2) { - i2 = class46.objectSizeX; - j2 = class46.objectSizeY; - } else { - i2 = class46.objectSizeY; - j2 = class46.objectSizeX; - } - int k2 = class46.surroundings; - if (l1 != 0) - k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1); - doWalkTo(2, 0, j2, 0, localPlayer.pathY[0], i2, k2, j, localPlayer.pathX[0], - false, k); + int j1 = scene.getMask(plane, k, j, i); + if (j1 == -1) + return false; + int k1 = j1 & 0x1f; + int l1 = j1 >> 6 & 3; + if (k1 == 10 || k1 == 11 || k1 == 22) { + ObjectDefinition class46 = ObjectDefinition.lookup(i1); + int i2; + int j2; + if (l1 == 0 || l1 == 2) { + i2 = class46.objectSizeX; + j2 = class46.objectSizeY; } else { - doWalkTo(2, l1, 0, k1 + 1, localPlayer.pathY[0], 0, 0, j, localPlayer.pathX[0], - false, k); + i2 = class46.objectSizeY; + j2 = class46.objectSizeX; } - crossX = super.saveClickX; - crossY = super.saveClickY; - crossType = 2; - crossIndex = 0; - return true; + int k2 = class46.surroundings; + if (l1 != 0) + k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1); + doWalkTo(2, 0, j2, 0, localPlayer.pathY[0], i2, k2, j, localPlayer.pathX[0], false, k); + } else { + doWalkTo(2, l1, 0, k1 + 1, localPlayer.pathY[0], 0, 0, j, localPlayer.pathX[0], false, k); + } + crossX = super.saveClickX; + crossY = super.saveClickY; + crossType = 2; + crossIndex = 0; + return true; } public void playSong(int id) { @@ -4427,13 +4107,9 @@ private void processTrackUpdates() { boolean replay = false; try { Buffer stream = Track.data(trackLoops[count], tracks[count]); - new SoundPlayer( - (InputStream) new ByteArrayInputStream(stream.payload, 0, - stream.currentPosition), - soundVolume[count], soundDelay[count]); - if (System.currentTimeMillis() - + (long) (stream.currentPosition / 22) > trackTimer - + (long) (currentTrackTime / 22)) { + new SoundPlayer(new ByteArrayInputStream(stream.payload, 0, stream.currentPosition), soundVolume[count], + soundDelay[count]); + if (System.currentTimeMillis() + stream.currentPosition / 22 > trackTimer + currentTrackTime / 22) { currentTrackTime = stream.currentPosition; trackTimer = System.currentTimeMillis(); if (saveWave(stream.payload, stream.currentPosition)) { @@ -4471,9 +4147,7 @@ private void processTrackUpdates() { } } - - private FileArchive createArchive(int file, String displayedName, String name, - int expectedCRC, int x) { + private FileArchive createArchive(int file, String displayedName, String name, int expectedCRC, int x) { byte archiveBuffer[] = null; int reconnectionDelay = 5; try { @@ -4498,9 +4172,9 @@ private FileArchive createArchive(int file, String displayedName, String name, String message = "Unknown error"; drawLoadingText(x, "Requesting " + displayedName); try { - + archiveBuffer = Jaggrab.readFile(Jaggrab.openRequest(name + expectedCRC)); - + try { if (indices[0] != null) indices[0].writeFile(archiveBuffer.length, archiveBuffer, file); @@ -4560,20 +4234,21 @@ private FileArchive createArchive(int file, String displayedName, String name, FileArchive streamLoader_1 = new FileArchive(archiveBuffer); return streamLoader_1; } - + private void dropClient() { if (anInt1011 > 0) { resetLogout(); return; } - Rasterizer2D.drawBoxOutline(2, 2, 229, 39, 0xffffff); // white box around + Rasterizer2D.drawBoxOutline(2, 2, 229, 39, 0xffffff); // white box + // around Rasterizer2D.drawBox(3, 3, 227, 37, 0); // black fill regularText.drawText(0, "Connection lost.", 19, 120); regularText.drawText(0xffffff, "Connection lost.", 18, 119); regularText.drawText(0, "Please wait - attempting to reestablish.", 34, 117); regularText.drawText(0xffffff, "Please wait - attempting to reestablish.", 34, 116); - gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, - super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0); + gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, + frameMode == ScreenMode.FIXED ? 4 : 0); minimapState = 0; destinationX = 0; BufferedConnection rsSocket = socketStream; @@ -4620,7 +4295,7 @@ private void showInterface(int interfaceId) { continuedDialogue = false; } - //TODO menu actions + // TODO menu actions private void processMenuActions(int id) { if (id < 0) { return; @@ -4634,7 +4309,7 @@ private void processMenuActions(int id) { } int first = firstMenuAction[id]; - int button = secondMenuAction[id]; + int button = secondMenuAction[id]; int action = menuActionTypes[id]; int clicked = selectedMenuActions[id]; @@ -4642,7 +4317,7 @@ private void processMenuActions(int id) { action -= 2000; } - //TODO unknown + // TODO unknown if (action == 851) { sendPacket(new ClickButton(155)); } @@ -4673,16 +4348,18 @@ private void processMenuActions(int id) { // custom if (action == 1506 && Configuration.enableOrbs) { // Select quick // prayers - /* outgoing.writeOpcode(185); - outgoing.writeShort(5001);*/ + /* + * outgoing.writeOpcode(185); outgoing.writeShort(5001); + */ } // custom if (action == 1500 && Configuration.enableOrbs) { // Toggle quick // prayers prayClicked = !prayClicked; - /* outgoing.writeOpcode(185); - outgoing.writeShort(5000);*/ + /* + * outgoing.writeOpcode(185); outgoing.writeShort(5000); + */ } // button clicks @@ -4714,28 +4391,22 @@ private void processMenuActions(int id) { if (action == 104) { Widget widget = Widget.interfaceCache[button]; sendPacket(new ClickButton(widget.id)); - /*spellId = widget.id; - if (!autocast) { - autocast = true; - autoCastId = widget.id; - sendPacket(new ClickButton(widget.id)); - } else if (autoCastId == widget.id) { - autocast = false; - autoCastId = 0; - sendPacket(new ClickButton(widget.id)); - } else if (autoCastId != widget.id) { - autocast = true; - autoCastId = widget.id; - sendPacket(new ClickButton(widget.id)); - }*/ + /* + * spellId = widget.id; if (!autocast) { autocast = true; autoCastId + * = widget.id; sendPacket(new ClickButton(widget.id)); } else if + * (autoCastId == widget.id) { autocast = false; autoCastId = 0; + * sendPacket(new ClickButton(widget.id)); } else if (autoCastId != + * widget.id) { autocast = true; autoCastId = widget.id; + * sendPacket(new ClickButton(widget.id)); } + */ } // item on npc if (action == 582) { Npc npc = npcs[clicked]; if (npc != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], - localPlayer.pathX[0], false, npc.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], localPlayer.pathX[0], false, + npc.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -4746,41 +4417,41 @@ private void processMenuActions(int id) { // picking up ground item if (action == 234) { - boolean flag1 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, - localPlayer.pathX[0], false, first); + boolean flag1 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, localPlayer.pathX[0], false, + first); if (!flag1) - flag1 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, - localPlayer.pathX[0], false, first); + flag1 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, localPlayer.pathX[0], false, first); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; - // pickup ground item + // pickup ground item sendPacket(new PickupItem(button + regionBaseY, clicked, first + regionBaseX)); } // using item on object if (action == 62 && clickObject(clicked, button, first)) { - sendPacket(new ItemOnObject(anInt1284, clicked >> 14 & 0x7fff, button + regionBaseY, anInt1283, first + regionBaseX, anInt1285)); + sendPacket(new ItemOnObject(anInt1284, clicked >> 14 & 0x7fff, button + regionBaseY, anInt1283, + first + regionBaseX, anInt1285)); } // using item on ground item if (action == 511) { - boolean flag2 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, - localPlayer.pathX[0], false, first); + boolean flag2 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, localPlayer.pathX[0], false, + first); if (!flag2) - flag2 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, - localPlayer.pathX[0], false, first); + flag2 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, localPlayer.pathX[0], false, first); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; // item on ground item - sendPacket(new ItemOnGroundItem(anInt1284, anInt1285, clicked, button + regionBaseY, anInt1283, first + regionBaseX)); + sendPacket(new ItemOnGroundItem(anInt1284, anInt1285, clicked, button + regionBaseY, anInt1283, + first + regionBaseX)); } // item option 1 - if (action == 74) { + if (action == 74) { sendPacket(new UseItem(button, clicked, first)); atInventoryLoopCycle = 0; atInventoryInterface = button; @@ -4819,7 +4490,7 @@ private void processMenuActions(int id) { break; default: - System.out.println("BUTTON = "+button); + System.out.println("BUTTON = " + button); sendPacket(new ClickButton(button)); break; @@ -4831,16 +4502,16 @@ private void processMenuActions(int id) { if (action == 561) { Player player = players[clicked]; if (player != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], - localPlayer.pathX[0], false, player.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], localPlayer.pathX[0], false, + player.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; anInt1188 += clicked; if (anInt1188 >= 90) { - //(anti-cheat) - // outgoing.writeOpcode(136); + // (anti-cheat) + // outgoing.writeOpcode(136); anInt1188 = 0; } sendPacket(new PlayerOption1(clicked)); @@ -4849,11 +4520,10 @@ private void processMenuActions(int id) { // npc option 1 if (action == 20) { - Npc npc = npcs[clicked]; + Npc npc = npcs[clicked]; if (npc != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - npc.pathY[0], localPlayer.pathX[0], - false, npc.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], localPlayer.pathX[0], false, + npc.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -4865,11 +4535,10 @@ private void processMenuActions(int id) { // player option 2 if (action == 779) { - Player player = players[clicked]; + Player player = players[clicked]; if (player != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - player.pathY[0], localPlayer.pathX[0], - false, player.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], localPlayer.pathX[0], false, + player.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -4909,8 +4578,8 @@ private void processMenuActions(int id) { continuedDialogue = true; } - //Pressed button - if(action == 647) { + // Pressed button + if (action == 647) { sendPacket(new ClickButtonAction(button, first)); } @@ -4929,12 +4598,11 @@ private void processMenuActions(int id) { } } - - if (action == 337 || action == 42 || action == 792 || action == 322) { + if (action == 337 || action == 42 || action == 792 || action == 322) { String string = menuActionText[id]; - int indexOf = string.indexOf("@whi@"); + int indexOf = string.indexOf("@whi@"); if (indexOf != -1) { - long usernameHash = StringUtils.encodeBase37(string.substring(indexOf + 5).trim()); + long usernameHash = StringUtils.encodeBase37(string.substring(indexOf + 5).trim()); if (action == 337) { addFriend(usernameHash); } @@ -4980,25 +4648,23 @@ private void processMenuActions(int id) { } } if (action == 484 || action == 6) { - String string = menuActionText[id]; - int indexOf = string.indexOf("@whi@"); + String string = menuActionText[id]; + int indexOf = string.indexOf("@whi@"); if (indexOf != -1) { string = string.substring(indexOf + 5).trim(); String username = StringUtils.formatText(StringUtils.decodeBase37(StringUtils.encodeBase37(string))); boolean flag9 = false; - for (int count = 0; count < playerCount; count++) { - Player player = players[playerList[count]]; + for (int count = 0; count < playerCount; count++) { + Player player = players[playerList[count]]; if (player == null || player.name == null || !player.name.equalsIgnoreCase(username)) { continue; } - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - player.pathY[0], - localPlayer.pathX[0], false, + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], localPlayer.pathX[0], false, player.pathX[0]); // accepting trade if (action == 484) { - //sendPacket(new ChatboxTrade(playerList[count])); + // sendPacket(new ChatboxTrade(playerList[count])); sendPacket(new TradePlayer(playerList[count])); } @@ -5007,7 +4673,7 @@ private void processMenuActions(int id) { anInt1188 += clicked; if (anInt1188 >= 90) { // (anti-cheat) - // outgoing.writeOpcode(136); + // outgoing.writeOpcode(136); anInt1188 = 0; } @@ -5036,7 +4702,7 @@ private void processMenuActions(int id) { atInventoryInterfaceType = 3; } - // Using the drop option of an item + // Using the drop option of an item if (action == 847) { // drop item sendPacket(new DropItem(clicked, button, first)); @@ -5067,10 +4733,11 @@ private void processMenuActions(int id) { // class9_1.sprite1.drawSprite(class9_1.x, class9_1.anInt265, // 0xffffff); // class9_1.sprite1.drawSprite(200,200); - //if (Configuration.client_debug) - // System.out.println( - // "spellId: " + spellId + " - spellSelected: " + spellSelected); - // System.out.println(button + " " + widget.selectedActionName + " " + anInt1137); + // if (Configuration.client_debug) + // System.out.println( + // "spellId: " + spellId + " - spellSelected: " + spellSelected); + // System.out.println(button + " " + widget.selectedActionName + " " + // + anInt1137); if (spellUsableOn == 16) { tabId = 3; tabAreaAltered = true; @@ -5094,20 +4761,19 @@ private void processMenuActions(int id) { // player option 2 if (action == 27) { - Player player = players[clicked]; + Player player = players[clicked]; if (player != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - player.pathY[0], localPlayer.pathX[0], - false, player.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], localPlayer.pathX[0], false, + player.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; anInt986 += clicked; if (anInt986 >= 54) { - //(anti-cheat) - // outgoing.writeOpcode(189); - // outgoing.writeByte(234); + // (anti-cheat) + // outgoing.writeOpcode(189); + // outgoing.writeByte(234); anInt986 = 0; } // attack player @@ -5117,20 +4783,20 @@ private void processMenuActions(int id) { // Used for lighting logs if (action == 213) { - boolean flag3 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, - localPlayer.pathX[0], false, first); + boolean flag3 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, localPlayer.pathX[0], false, + first); if (!flag3) - flag3 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, - localPlayer.pathX[0], false, first); + flag3 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, localPlayer.pathX[0], false, first); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; // light item - /*outgoing.writeOpcode(79); - outgoing.writeLEShort(button + regionBaseY); - outgoing.writeShort(clicked); - outgoing.writeShortA(first + regionBaseX);*/ + /* + * outgoing.writeOpcode(79); outgoing.writeLEShort(button + + * regionBaseY); outgoing.writeShort(clicked); + * outgoing.writeShortA(first + regionBaseX); + */ } // Using the unequip option on the equipment tab interface @@ -5304,29 +4970,28 @@ private void processMenuActions(int id) { // clicking some sort of tile if (action == 652) { - boolean flag4 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, - localPlayer.pathX[0], false, first); + boolean flag4 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, localPlayer.pathX[0], false, + first); if (!flag4) - flag4 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, - localPlayer.pathX[0], false, first); + flag4 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, localPlayer.pathX[0], false, first); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; - //unknown (non-anti bot) - /*outgoing.writeOpcode(156); - outgoing.writeShortA(first + regionBaseX); - outgoing.writeLEShort(button + regionBaseY); - outgoing.writeLEShortA(clicked);*/ + // unknown (non-anti bot) + /* + * outgoing.writeOpcode(156); outgoing.writeShortA(first + + * regionBaseX); outgoing.writeLEShort(button + regionBaseY); + * outgoing.writeLEShortA(clicked); + */ } // Using a spell on a ground item if (action == 94) { - boolean flag5 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, - localPlayer.pathX[0], false, first); + boolean flag5 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, localPlayer.pathX[0], false, + first); if (!flag5) - flag5 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, - localPlayer.pathX[0], false, first); + flag5 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, localPlayer.pathX[0], false, first); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5337,7 +5002,7 @@ private void processMenuActions(int id) { if (action == 646) { // button click - switch(button) { + switch (button) { case 930: Client.cameraZoom = 1200; break; @@ -5368,7 +5033,7 @@ private void processMenuActions(int id) { break; } - Widget widget = Widget.interfaceCache[button]; + Widget widget = Widget.interfaceCache[button]; if (widget.valueIndexArray != null && widget.valueIndexArray[0][0] == 5) { int i2 = widget.valueIndexArray[0][1]; if (settings[i2] != widget.requiredValues[0]) { @@ -5380,11 +5045,10 @@ private void processMenuActions(int id) { // Using the 2nd option of an npc if (action == 225) { - Npc npc = npcs[clicked]; + Npc npc = npcs[clicked]; if (npc != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - npc.pathY[0], localPlayer.pathX[0], - false, npc.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], localPlayer.pathX[0], false, + npc.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5392,8 +5056,8 @@ private void processMenuActions(int id) { anInt1226 += clicked; if (anInt1226 >= 85) { // (anti-cheat) - //outgoing.writeOpcode(230); - //outgoing.writeByte(239); + // outgoing.writeOpcode(230); + // outgoing.writeByte(239); anInt1226 = 0; } // npc option 2 @@ -5403,20 +5067,19 @@ private void processMenuActions(int id) { // Using the 3rd option of an npc if (action == 965) { - Npc npc = npcs[clicked]; + Npc npc = npcs[clicked]; if (npc != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - npc.pathY[0], localPlayer.pathX[0], - false, npc.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], localPlayer.pathX[0], false, + npc.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; anInt1134++; if (anInt1134 >= 96) { - //(anti-cheat) - //outgoing.writeOpcode(152); - //outgoing.writeByte(88); + // (anti-cheat) + // outgoing.writeOpcode(152); + // outgoing.writeByte(88); anInt1134 = 0; } // npc option 3 @@ -5428,8 +5091,8 @@ private void processMenuActions(int id) { if (action == 413) { Npc npc = npcs[clicked]; if (npc != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], - localPlayer.pathX[0], false, npc.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], localPlayer.pathX[0], false, + npc.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5446,7 +5109,7 @@ private void processMenuActions(int id) { // Clicking "Examine" option on an npc if (action == 1025 || action == 1025) { - Npc npc = npcs[clicked]; + Npc npc = npcs[clicked]; if (npc != null) { NpcDefinition entityDef = npc.desc; if (entityDef.childrenIDs != null) @@ -5465,11 +5128,10 @@ private void processMenuActions(int id) { // Using the "Attack" option on a npc if (action == 412) { - Npc npc = npcs[clicked]; + Npc npc = npcs[clicked]; if (npc != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - npc.pathY[0], localPlayer.pathX[0], - false, npc.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], localPlayer.pathX[0], false, + npc.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5482,8 +5144,8 @@ private void processMenuActions(int id) { if (action == 365) { Player player = players[clicked]; if (player != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], - localPlayer.pathX[0], false, player.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], localPlayer.pathX[0], false, + player.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5495,11 +5157,10 @@ private void processMenuActions(int id) { // Using the 3rd option of a player if (action == 729) { - Player player = players[clicked]; + Player player = players[clicked]; if (player != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - player.pathY[0], localPlayer.pathX[0], - false, player.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], localPlayer.pathX[0], false, + player.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5510,11 +5171,10 @@ private void processMenuActions(int id) { // Using the 4th option of a player if (action == 577) { - Player player = players[clicked]; + Player player = players[clicked]; if (player != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - player.pathY[0], localPlayer.pathX[0], - false, player.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], localPlayer.pathX[0], false, + player.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5527,25 +5187,26 @@ private void processMenuActions(int id) { // Using a spell on an item if (action == 956 && clickObject(clicked, button, first)) { // magic on item - // sendPacket(new MagicOnItem(first + regionBaseX, anInt1137, button + regionBaseY, clicked >> 14 & 0x7fff)); + // sendPacket(new MagicOnItem(first + regionBaseX, anInt1137, button + // + regionBaseY, clicked >> 14 & 0x7fff)); } // Some walking action (packet 23) if (action == 567) { - boolean flag6 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, - localPlayer.pathX[0], false, first); + boolean flag6 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, localPlayer.pathX[0], false, + first); if (!flag6) - flag6 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, - localPlayer.pathX[0], false, first); + flag6 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, localPlayer.pathX[0], false, first); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; - //anti-cheat) - /*outgoing.writeOpcode(23); - outgoing.writeLEShort(button + regionBaseY); - outgoing.writeLEShort(clicked); - outgoing.writeLEShort(first + regionBaseX);*/ + // anti-cheat) + /* + * outgoing.writeOpcode(23); outgoing.writeLEShort(button + + * regionBaseY); outgoing.writeLEShort(clicked); + * outgoing.writeLEShort(first + regionBaseX); + */ } // Using the bank 10 option on the bank interface @@ -5556,9 +5217,9 @@ private void processMenuActions(int id) { } if (anInt1175 >= 59) { - //(anti-cheat) - //outgoing.writeOpcode(200); - //outgoing.writeShort(25501); + // (anti-cheat) + // outgoing.writeOpcode(200); + // outgoing.writeShort(25501); anInt1175 = 0; } // bank 10 @@ -5597,17 +5258,14 @@ private void processMenuActions(int id) { reportAbuseInput = s2.substring(j2 + 5).trim(); canMute = false; for (int index = 0; index < Widget.interfaceCache.length; index++) { - if (Widget.interfaceCache[index] == null - || Widget.interfaceCache[index].contentType != 600) + if (Widget.interfaceCache[index] == null || Widget.interfaceCache[index].contentType != 600) continue; - reportAbuseInterfaceID = openInterfaceId = - Widget.interfaceCache[index].parent; + reportAbuseInterfaceID = openInterfaceId = Widget.interfaceCache[index].parent; break; } } else { - sendMessage("Please close the interface you have open before using 'report abuse'", - 0, ""); + sendMessage("Please close the interface you have open before using 'report abuse'", 0, ""); } } @@ -5616,9 +5274,8 @@ private void processMenuActions(int id) { Player player = players[clicked]; if (player != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - player.pathY[0], localPlayer.pathX[0], - false, player.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, player.pathY[0], localPlayer.pathX[0], false, + player.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5630,14 +5287,14 @@ private void processMenuActions(int id) { // reply to private message if (action == 639) { - String text = menuActionText[id]; + String text = menuActionText[id]; - int indexOf = text.indexOf("@whi@"); + int indexOf = text.indexOf("@whi@"); if (indexOf != -1) { - long usernameHash = StringUtils.encodeBase37(text.substring(indexOf + 5).trim()); + long usernameHash = StringUtils.encodeBase37(text.substring(indexOf + 5).trim()); int resultIndex = -1; - for (int friendIndex = 0; friendIndex < friendsCount; friendIndex++) { + for (int friendIndex = 0; friendIndex < friendsCount; friendIndex++) { if (friendsListAsLongs[friendIndex] != usernameHash) { continue; } @@ -5645,7 +5302,7 @@ private void processMenuActions(int id) { break; } - if (resultIndex != -1 && friendsNodeIDs[resultIndex] > 0) { + if (resultIndex != -1 && friendsNodeIDs[resultIndex] > 0) { updateChatbox = true; inputDialogState = 0; messagePromptRaised = true; @@ -5659,7 +5316,7 @@ private void processMenuActions(int id) { // Using the equip option of an item in the inventory if (action == 454) { - //equip item + // equip item sendPacket(new EquipItem(clicked, first, button)); atInventoryLoopCycle = 0; atInventoryInterface = button; @@ -5673,11 +5330,10 @@ private void processMenuActions(int id) { // Npc option 4 if (action == 478) { - Npc npc = npcs[clicked]; + Npc npc = npcs[clicked]; if (npc != null) { - doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, - npc.pathY[0], localPlayer.pathX[0], - false, npc.pathX[0]); + doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, npc.pathY[0], localPlayer.pathX[0], false, + npc.pathX[0]); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; @@ -5688,9 +5344,9 @@ private void processMenuActions(int id) { } if (anInt1155 >= 53) { - //TODO unknown (anti-cheat) - // outgoing.writeOpcode(85); - // outgoing.writeByte(66); + // TODO unknown (anti-cheat) + // outgoing.writeOpcode(85); + // outgoing.writeByte(66); anInt1155 = 0; } @@ -5718,12 +5374,11 @@ private void processMenuActions(int id) { sendPacket(new ObjectOption1(first + regionBaseX, clicked >> 14 & 0x7fff, button + regionBaseY)); } - if (action == 169) { sendPacket(new ClickButton(button)); - if(button != 19158) { //Run button, server handles config + if (button != 19158) { // Run button, server handles config Widget widget = Widget.interfaceCache[button]; if (widget.valueIndexArray != null && widget.valueIndexArray[0][0] == 5) { @@ -5745,9 +5400,9 @@ private void processMenuActions(int id) { } if (action == 1226) { - int objectId = clicked >> 14 & 0x7fff; - ObjectDefinition definition = ObjectDefinition.lookup(objectId); - String message; + int objectId = clicked >> 14 & 0x7fff; + ObjectDefinition definition = ObjectDefinition.lookup(objectId); + String message; if (definition.description != null) message = new String(definition.description); else @@ -5757,26 +5412,25 @@ private void processMenuActions(int id) { // Click First Option Ground Item if (action == 244) { - boolean flag7 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, - localPlayer.pathX[0], false, first); + boolean flag7 = doWalkTo(2, 0, 0, 0, localPlayer.pathY[0], 0, 0, button, localPlayer.pathX[0], false, + first); if (!flag7) - flag7 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, - localPlayer.pathX[0], false, first); + flag7 = doWalkTo(2, 0, 1, 0, localPlayer.pathY[0], 1, 0, button, localPlayer.pathX[0], false, first); crossX = super.saveClickX; crossY = super.saveClickY; crossType = 2; crossIndex = 0; - /*TODO: NO idea SOMETHING WITH GROUNDITEMS - outgoing.writeOpcode(253); - outgoing.writeLEShort(first + regionBaseX); - outgoing.writeLEShortA(button + regionBaseY); - outgoing.writeShortA(clicked);*/ + /* + * TODO: NO idea SOMETHING WITH GROUNDITEMS + * outgoing.writeOpcode(253); outgoing.writeLEShort(first + + * regionBaseX); outgoing.writeLEShortA(button + regionBaseY); + * outgoing.writeShortA(clicked); + */ } - if (action == 1448 || action == 1125) { - ItemDefinition definition = ItemDefinition.lookup(clicked); - if(definition != null) { + ItemDefinition definition = ItemDefinition.lookup(clicked); + if (definition != null) { sendPacket(new ExamineItem(clicked)); } } @@ -5799,6 +5453,7 @@ private void tutorialIslandAreas() { onTutorialIsland = 0; } + @Override public void run() { if (drawFlames) { drawFlames(); @@ -5824,202 +5479,177 @@ private void createMenu() { int l = Model.anIntArray1688[k]; int i1 = l & 0x7f; int j1 = l >> 7 & 0x7f; - int k1 = l >> 29 & 3; - int l1 = l >> 14 & 0x7fff; - if (l == j) - continue; - j = l; - if (k1 == 2 && scene.getMask(plane, i1, j1, l) >= 0) { - ObjectDefinition objectDef = ObjectDefinition.lookup(l1); - if (objectDef.childrenIDs != null) - objectDef = objectDef.method580(); - if (objectDef == null) + int k1 = l >> 29 & 3; + int l1 = l >> 14 & 0x7fff; + if (l == j) continue; - if (itemSelected == 1) { - menuActionText[menuActionRow] = "Use " + selectedItemName - + " with @cya@" + objectDef.name; - menuActionTypes[menuActionRow] = 62; - selectedMenuActions[menuActionRow] = l; - firstMenuAction[menuActionRow] = i1; - secondMenuAction[menuActionRow] = j1; - menuActionRow++; - } else if (spellSelected == 1) { - if ((spellUsableOn & 4) == 4) { - menuActionText[menuActionRow] = - spellTooltip + " @cya@" + objectDef.name; - menuActionTypes[menuActionRow] = 956; + j = l; + if (k1 == 2 && scene.getMask(plane, i1, j1, l) >= 0) { + ObjectDefinition objectDef = ObjectDefinition.lookup(l1); + if (objectDef.childrenIDs != null) + objectDef = objectDef.method580(); + if (objectDef == null) + continue; + if (itemSelected == 1) { + menuActionText[menuActionRow] = "Use " + selectedItemName + " with @cya@" + objectDef.name; + menuActionTypes[menuActionRow] = 62; selectedMenuActions[menuActionRow] = l; firstMenuAction[menuActionRow] = i1; secondMenuAction[menuActionRow] = j1; menuActionRow++; - } - } else { - if (objectDef.interactions != null) { - for (int type = 4; type >= 0; type--) - if (objectDef.interactions[type] != null) { - menuActionText[menuActionRow] = - objectDef.interactions[type] + " @cya@" - + objectDef.name; - if (type == 0) - menuActionTypes[menuActionRow] = 502; - if (type == 1) - menuActionTypes[menuActionRow] = 900; - if (type == 2) - menuActionTypes[menuActionRow] = 113; - if (type == 3) - menuActionTypes[menuActionRow] = 872; - if (type == 4) - menuActionTypes[menuActionRow] = 1062; - selectedMenuActions[menuActionRow] = l; - firstMenuAction[menuActionRow] = i1; - secondMenuAction[menuActionRow] = j1; - menuActionRow++; - } + } else if (spellSelected == 1) { + if ((spellUsableOn & 4) == 4) { + menuActionText[menuActionRow] = spellTooltip + " @cya@" + objectDef.name; + menuActionTypes[menuActionRow] = 956; + selectedMenuActions[menuActionRow] = l; + firstMenuAction[menuActionRow] = i1; + secondMenuAction[menuActionRow] = j1; + menuActionRow++; + } + } else { + if (objectDef.interactions != null) { + for (int type = 4; type >= 0; type--) + if (objectDef.interactions[type] != null) { + menuActionText[menuActionRow] = objectDef.interactions[type] + " @cya@" + + objectDef.name; + if (type == 0) + menuActionTypes[menuActionRow] = 502; + if (type == 1) + menuActionTypes[menuActionRow] = 900; + if (type == 2) + menuActionTypes[menuActionRow] = 113; + if (type == 3) + menuActionTypes[menuActionRow] = 872; + if (type == 4) + menuActionTypes[menuActionRow] = 1062; + selectedMenuActions[menuActionRow] = l; + firstMenuAction[menuActionRow] = i1; + secondMenuAction[menuActionRow] = j1; + menuActionRow++; + } + } + if (Configuration.enableIds && (myPrivilege >= 2 || myPrivilege <= 3)) { + menuActionText[menuActionRow] = "Examine @cya@" + objectDef.name + " @gre@(@whi@" + l1 + + "@gre@) (@whi@" + (i1 + regionBaseX) + "," + (j1 + regionBaseY) + "@gre@)"; + } else { + menuActionText[menuActionRow] = "Examine @cya@" + objectDef.name; + } + menuActionTypes[menuActionRow] = 1226; + selectedMenuActions[menuActionRow] = objectDef.type << 14; + firstMenuAction[menuActionRow] = i1; + secondMenuAction[menuActionRow] = j1; + menuActionRow++; } - if (Configuration.enableIds - && (myPrivilege >= 2 || myPrivilege <= 3)) { - menuActionText[menuActionRow] = "Examine @cya@" + objectDef.name - + " @gre@(@whi@" + l1 + "@gre@) (@whi@" - + (i1 + regionBaseX) + "," + (j1 + regionBaseY) - + "@gre@)"; - } else { - menuActionText[menuActionRow] = - "Examine @cya@" + objectDef.name; + } + if (k1 == 1) { + Npc npc = npcs[l1]; + try { + if (npc.desc.size == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) { + for (int j2 = 0; j2 < npcCount; j2++) { + Npc npc2 = npcs[npcIndices[j2]]; + if (npc2 != null && npc2 != npc && npc2.desc.size == 1 && npc2.x == npc.x + && npc2.y == npc.y) + buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1); + } + for (int l2 = 0; l2 < playerCount; l2++) { + Player player = players[playerList[l2]]; + if (player != null && player.x == npc.x && player.y == npc.y) + buildAtPlayerMenu(i1, playerList[l2], player, j1); + } + } + buildAtNPCMenu(npc.desc, l1, j1, i1); + } catch (Exception e) { } - menuActionTypes[menuActionRow] = 1226; - selectedMenuActions[menuActionRow] = objectDef.type << 14; - firstMenuAction[menuActionRow] = i1; - secondMenuAction[menuActionRow] = j1; - menuActionRow++; } - } - if (k1 == 1) { - Npc npc = npcs[l1]; - try { - if (npc.desc.size == 1 && (npc.x & 0x7f) == 64 - && (npc.y & 0x7f) == 64) { - for (int j2 = 0; j2 < npcCount; j2++) { - Npc npc2 = npcs[npcIndices[j2]]; - if (npc2 != null && npc2 != npc && npc2.desc.size == 1 - && npc2.x == npc.x && npc2.y == npc.y) - buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1); - } - for (int l2 = 0; l2 < playerCount; l2++) { - Player player = players[playerList[l2]]; - if (player != null && player.x == npc.x - && player.y == npc.y) - buildAtPlayerMenu(i1, playerList[l2], player, - j1); - } - } - buildAtNPCMenu(npc.desc, l1, j1, i1); - } catch (Exception e) { + if (k1 == 0) { + Player player = players[l1]; + if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) { + for (int k2 = 0; k2 < npcCount; k2++) { + Npc class30_sub2_sub4_sub1_sub1_2 = npcs[npcIndices[k2]]; + if (class30_sub2_sub4_sub1_sub1_2 != null && class30_sub2_sub4_sub1_sub1_2.desc.size == 1 + && class30_sub2_sub4_sub1_sub1_2.x == player.x + && class30_sub2_sub4_sub1_sub1_2.y == player.y) + buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, npcIndices[k2], j1, i1); + } + + for (int i3 = 0; i3 < playerCount; i3++) { + Player class30_sub2_sub4_sub1_sub2_2 = players[playerList[i3]]; + if (class30_sub2_sub4_sub1_sub2_2 != null && class30_sub2_sub4_sub1_sub2_2 != player + && class30_sub2_sub4_sub1_sub2_2.x == player.x + && class30_sub2_sub4_sub1_sub2_2.y == player.y) + buildAtPlayerMenu(i1, playerList[i3], class30_sub2_sub4_sub1_sub2_2, j1); + } + + } + buildAtPlayerMenu(i1, l1, player, j1); } - } - if (k1 == 0) { - Player player = players[l1]; - if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) { - for (int k2 = 0; k2 < npcCount; k2++) { - Npc class30_sub2_sub4_sub1_sub1_2 = npcs[npcIndices[k2]]; - if (class30_sub2_sub4_sub1_sub1_2 != null - && class30_sub2_sub4_sub1_sub1_2.desc.size == 1 - && class30_sub2_sub4_sub1_sub1_2.x == player.x - && class30_sub2_sub4_sub1_sub1_2.y == player.y) - buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, - npcIndices[k2], j1, i1); - } - - for (int i3 = 0; i3 < playerCount; i3++) { - Player class30_sub2_sub4_sub1_sub2_2 = - players[playerList[i3]]; - if (class30_sub2_sub4_sub1_sub2_2 != null - && class30_sub2_sub4_sub1_sub2_2 != player - && class30_sub2_sub4_sub1_sub2_2.x == player.x - && class30_sub2_sub4_sub1_sub2_2.y == player.y) - buildAtPlayerMenu(i1, playerList[i3], - class30_sub2_sub4_sub1_sub2_2, j1); - } - - } - buildAtPlayerMenu(i1, l1, player, j1); - } - if (k1 == 3) { - Deque class19 = groundItems[plane][i1][j1]; - if (class19 != null) { - for (Item item = (Item) class19.getFirst(); item != null; item = - (Item) class19.getNext()) { - ItemDefinition itemDef = ItemDefinition.lookup(item.ID); - if (itemSelected == 1) { - menuActionText[menuActionRow] = "Use " + selectedItemName - + " with @lre@" + itemDef.name; - menuActionTypes[menuActionRow] = 511; - selectedMenuActions[menuActionRow] = item.ID; - firstMenuAction[menuActionRow] = i1; - secondMenuAction[menuActionRow] = j1; - menuActionRow++; - } else if (spellSelected == 1) { - if ((spellUsableOn & 1) == 1) { - menuActionText[menuActionRow] = - spellTooltip + " @lre@" + itemDef.name; - menuActionTypes[menuActionRow] = 94; + if (k1 == 3) { + Deque class19 = groundItems[plane][i1][j1]; + if (class19 != null) { + for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19.getNext()) { + ItemDefinition itemDef = ItemDefinition.lookup(item.ID); + if (itemSelected == 1) { + menuActionText[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name; + menuActionTypes[menuActionRow] = 511; selectedMenuActions[menuActionRow] = item.ID; firstMenuAction[menuActionRow] = i1; secondMenuAction[menuActionRow] = j1; menuActionRow++; - } - } else { - for (int j3 = 4; j3 >= 0; j3--) - if (itemDef.groundActions != null - && itemDef.groundActions[j3] != null) { - menuActionText[menuActionRow] = - itemDef.groundActions[j3] - + " @lre@" - + itemDef.name; - if (j3 == 0) - menuActionTypes[menuActionRow] = 652; - if (j3 == 1) - menuActionTypes[menuActionRow] = 567; - if (j3 == 2) - menuActionTypes[menuActionRow] = 234; - if (j3 == 3) - menuActionTypes[menuActionRow] = 244; - if (j3 == 4) - menuActionTypes[menuActionRow] = 213; - selectedMenuActions[menuActionRow] = item.ID; - firstMenuAction[menuActionRow] = i1; - secondMenuAction[menuActionRow] = j1; - menuActionRow++; - } else if (j3 == 2) { - menuActionText[menuActionRow] = - "Take @lre@" + itemDef.name; - menuActionTypes[menuActionRow] = 234; + } else if (spellSelected == 1) { + if ((spellUsableOn & 1) == 1) { + menuActionText[menuActionRow] = spellTooltip + " @lre@" + itemDef.name; + menuActionTypes[menuActionRow] = 94; selectedMenuActions[menuActionRow] = item.ID; firstMenuAction[menuActionRow] = i1; secondMenuAction[menuActionRow] = j1; menuActionRow++; } + } else { + for (int j3 = 4; j3 >= 0; j3--) + if (itemDef.groundActions != null && itemDef.groundActions[j3] != null) { + menuActionText[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name; + if (j3 == 0) + menuActionTypes[menuActionRow] = 652; + if (j3 == 1) + menuActionTypes[menuActionRow] = 567; + if (j3 == 2) + menuActionTypes[menuActionRow] = 234; + if (j3 == 3) + menuActionTypes[menuActionRow] = 244; + if (j3 == 4) + menuActionTypes[menuActionRow] = 213; + selectedMenuActions[menuActionRow] = item.ID; + firstMenuAction[menuActionRow] = i1; + secondMenuAction[menuActionRow] = j1; + menuActionRow++; + } else if (j3 == 2) { + menuActionText[menuActionRow] = "Take @lre@" + itemDef.name; + menuActionTypes[menuActionRow] = 234; + selectedMenuActions[menuActionRow] = item.ID; + firstMenuAction[menuActionRow] = i1; + secondMenuAction[menuActionRow] = j1; + menuActionRow++; + } + } + if (Configuration.enableIds && (myPrivilege >= 2 && myPrivilege <= 3)) { + menuActionText[menuActionRow] = "Examine @lre@" + itemDef.name + " @gre@ (@whi@" + item.ID + + "@gre@)"; + } else { + menuActionText[menuActionRow] = "Examine @lre@" + itemDef.name; + } + menuActionTypes[menuActionRow] = 1448; + selectedMenuActions[menuActionRow] = item.ID; + firstMenuAction[menuActionRow] = i1; + secondMenuAction[menuActionRow] = j1; + menuActionRow++; } - if (Configuration.enableIds - && (myPrivilege >= 2 && myPrivilege <= 3)) { - menuActionText[menuActionRow] = "Examine @lre@" - + itemDef.name + " @gre@ (@whi@" + item.ID - + "@gre@)"; - } else { - menuActionText[menuActionRow] = - "Examine @lre@" + itemDef.name; - } - menuActionTypes[menuActionRow] = 1448; - selectedMenuActions[menuActionRow] = item.ID; - firstMenuAction[menuActionRow] = i1; - secondMenuAction[menuActionRow] = j1; - menuActionRow++; } } } - } } + @Override public void cleanUpForQuit() { SignLink.reporterror = false; try { @@ -6134,6 +5764,7 @@ public void cleanUpForQuit() { System.gc(); } + @Override Component getGameComponent() { if (SignLink.mainapp != null) return SignLink.mainapp; @@ -6144,7 +5775,7 @@ Component getGameComponent() { } public static void escapePressed() { - if(!loggedIn) { + if (!loggedIn) { return; } @@ -6160,22 +5791,19 @@ private void manageTextInputs() { int key = readChar(-796); if (key == -1 || key == 96) break; - if(key == 167 || key == 96) { - if(myPrivilege >= 1 && myPrivilege <= 4) { + if (key == 167 || key == 96) { + if (myPrivilege >= 1 && myPrivilege <= 4) { consoleOpen = !consoleOpen; } return; } if (consoleOpen) { if (key == 8 && consoleInput.length() > 0) - consoleInput = consoleInput.substring(0, - consoleInput.length() - 1); - if (key >= 32 && key <= 122 - && consoleInput.length() < 80) + consoleInput = consoleInput.substring(0, consoleInput.length() - 1); + if (key >= 32 && key <= 122 && consoleInput.length() < 80) consoleInput += (char) key; - if ((key == 13 || key == 10) - && consoleInput.length() >= 1) { + if ((key == 13 || key == 10) && consoleInput.length() >= 1) { printConsoleMessage(consoleInput, 0); sendCommandPacket(consoleInput); consoleInput = ""; @@ -6184,25 +5812,26 @@ private void manageTextInputs() { return; } - //Space bar skipping dialogue - if (!continuedDialogue && inputDialogState == 0 && backDialogueId > 0 && loggedIn && openInterfaceId == -1) { - //System.out.println(key); + // Space bar skipping dialogue + if (!continuedDialogue && inputDialogState == 0 && backDialogueId > 0 && loggedIn + && openInterfaceId == -1) { + // System.out.println(key); - //Simple continue action with space bar - if(key == 32 && backDialogueId == 4893) { + // Simple continue action with space bar + if (key == 32 && backDialogueId == 4893) { sendPacket(new NextDialogue(4899)); continuedDialogue = true; - } + } - //3 Options - if(backDialogueId == 2469) { - if(key == 49) { //Option 1 + // 3 Options + if (backDialogueId == 2469) { + if (key == 49) { // Option 1 sendPacket(new ClickButton(2471)); continuedDialogue = true; - } else if(key == 50) { //Option 2 + } else if (key == 50) { // Option 2 sendPacket(new ClickButton(2472)); continuedDialogue = true; - } else if(key == 51) { //Option 3 + } else if (key == 51) { // Option 3 sendPacket(new ClickButton(2473)); continuedDialogue = true; } @@ -6212,10 +5841,9 @@ private void manageTextInputs() { if (openInterfaceId != -1 && openInterfaceId == reportAbuseInterfaceID) { if (key == 8 && reportAbuseInput.length() > 0) - reportAbuseInput = reportAbuseInput.substring(0, - reportAbuseInput.length() - 1); - if ((key >= 97 && key <= 122 || key >= 65 && key <= 90 || key >= 48 && key <= 57 - || key == 32) && reportAbuseInput.length() < 12) + reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1); + if ((key >= 97 && key <= 122 || key >= 65 && key <= 90 || key >= 48 && key <= 57 || key == 32) + && reportAbuseInput.length() < 12) reportAbuseInput += (char) key; } else if (messagePromptRaised) { if (key >= 32 && key <= 122 && promptInput.length() < 80) { @@ -6239,17 +5867,18 @@ private void manageTextInputs() { } if (friendsListAction == 3 && promptInput.length() > 0) { // private message - /* outgoing.writeOpcode(126); - outgoing.writeByte(0); - int k = outgoing.currentPosition; - outgoing.writeLong(aLong953); - ChatMessageCodec.encode(promptInput, outgoing); - outgoing.writeBytes(outgoing.currentPosition - k); - promptInput = ChatMessageCodec.processText(promptInput);*/ + /* + * outgoing.writeOpcode(126); outgoing.writeByte(0); int + * k = outgoing.currentPosition; + * outgoing.writeLong(aLong953); + * ChatMessageCodec.encode(promptInput, outgoing); + * outgoing.writeBytes(outgoing.currentPosition - k); + * promptInput = + * ChatMessageCodec.processText(promptInput); + */ sendPacket(new PrivateMessage(aLong953, promptInput)); // promptInput = Censor.doCensor(promptInput); - sendMessage(promptInput, 6, StringUtils.formatText( - StringUtils.decodeBase37(aLong953))); + sendMessage(promptInput, 6, StringUtils.formatText(StringUtils.decodeBase37(aLong953))); if (privateChatMode == 2) { privateChatMode = 1; // privacy option @@ -6266,7 +5895,7 @@ private void manageTextInputs() { } if (friendsListAction == 6) { long l3 = StringUtils.encodeBase37(promptInput); - // chatJoin(l3); + // chatJoin(l3); } } } else if (inputDialogState == 1) { @@ -6275,8 +5904,7 @@ private void manageTextInputs() { updateChatbox = true; } if (key == 8 && amountOrNameInput.length() > 0) { - amountOrNameInput = amountOrNameInput.substring(0, - amountOrNameInput.length() - 1); + amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1); updateChatbox = true; } if (key == 13 || key == 10) { @@ -6307,7 +5935,7 @@ private void manageTextInputs() { } if (amount > 0) { - sendPacket(new EnterAmount((int)amount)); + sendPacket(new EnterAmount((int) amount)); } } inputDialogState = 0; @@ -6319,8 +5947,7 @@ private void manageTextInputs() { updateChatbox = true; } if (key == 8 && amountOrNameInput.length() > 0) { - amountOrNameInput = amountOrNameInput.substring(0, - amountOrNameInput.length() - 1); + amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1); updateChatbox = true; } if (key == 13 || key == 10) { @@ -6350,12 +5977,12 @@ private void manageTextInputs() { sendPacket(new Command(inputString.substring(2))); } else { String text = inputString.toLowerCase(); - int colorCode = 0; + int colorCode = 0; if (text.startsWith("yellow:")) { colorCode = 0; inputString = inputString.substring(7); } else if (text.startsWith("red:")) { - colorCode = 1; + colorCode = 1; inputString = inputString.substring(4); } else if (text.startsWith("green:")) { colorCode = 2; @@ -6384,11 +6011,11 @@ private void manageTextInputs() { } else if (text.startsWith("glow2:")) { colorCode = 10; inputString = inputString.substring(6); - } else if (text.startsWith("glow3:")) { + } else if (text.startsWith("glow3:")) { colorCode = 11; inputString = inputString.substring(6); } - text = inputString.toLowerCase(); + text = inputString.toLowerCase(); int effectCode = 0; if (text.startsWith("wave:")) { effectCode = 1; @@ -6407,17 +6034,19 @@ private void manageTextInputs() { inputString = inputString.substring(6); } // chat - /*outgoing.writeOpcode(4); - outgoing.writeByte(0); - int bufPos = outgoing.currentPosition; - outgoing.writeByteS(effectCode); - outgoing.writeByteS(colorCode); - chatBuffer.currentPosition = 0; - ChatMessageCodec.encode(inputString, chatBuffer); - outgoing.writeReverseDataA(chatBuffer.payload, 0, - chatBuffer.currentPosition); - outgoing.writeBytes(outgoing.currentPosition - bufPos); - inputString = ChatMessageCodec.processText(inputString);*/ + /* + * outgoing.writeOpcode(4); outgoing.writeByte(0); int + * bufPos = outgoing.currentPosition; + * outgoing.writeByteS(effectCode); + * outgoing.writeByteS(colorCode); + * chatBuffer.currentPosition = 0; + * ChatMessageCodec.encode(inputString, chatBuffer); + * outgoing.writeReverseDataA(chatBuffer.payload, 0, + * chatBuffer.currentPosition); + * outgoing.writeBytes(outgoing.currentPosition - + * bufPos); inputString = + * ChatMessageCodec.processText(inputString); + */ // inputString = Censor.doCensor(inputString); inputString = StringUtils.formatText(inputString); sendPacket(new Chat(colorCode, effectCode, inputString)); @@ -6426,11 +6055,9 @@ private void manageTextInputs() { localPlayer.textEffect = effectCode; localPlayer.textCycle = 150; if (myPrivilege == 2) { - sendMessage(localPlayer.spokenText, 2, - "@cr2@" + localPlayer.name); + sendMessage(localPlayer.spokenText, 2, "@cr2@" + localPlayer.name); } else if (myPrivilege == 1) { - sendMessage(localPlayer.spokenText, 2, - "@cr1@" + localPlayer.name); + sendMessage(localPlayer.spokenText, 2, "@cr1@" + localPlayer.name); } else { sendMessage(localPlayer.spokenText, 2, localPlayer.name); } @@ -6461,7 +6088,7 @@ private void buildPublicChat(int j) { int privacyOptionType = chatTypes[message]; - String crownName = chatNames[message]; + String crownName = chatNames[message]; int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5; @@ -6520,12 +6147,10 @@ private void buildFriendChat(int j) { if (s != null && s.startsWith("@cr3@")) s = s.substring(5); if ((j1 == 5 || j1 == 6) && (splitPrivateChat == 0 || chatTypeView == 2) - && (j1 == 6 || privateChatMode == 0 - || privateChatMode == 1 && isFriendOrSelf(s))) + && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) l++; if ((j1 == 3 || j1 == 7) && (splitPrivateChat == 0 || chatTypeView == 2) - && (j1 == 7 || privateChatMode == 0 - || privateChatMode == 1 && isFriendOrSelf(s))) { + && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) { if (j > k1 - 14 && j <= k1) { if (myPrivilege >= 1) { menuActionText[menuActionRow] = "Report abuse @whi@" + s; @@ -6562,8 +6187,7 @@ private void buildDuelorTrade(int j) { s = s.substring(5); if (s != null && s.startsWith("@cr3@")) s = s.substring(5); - if (chatTypeView == 3 && j1 == 4 - && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) { + if (chatTypeView == 3 && j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) { if (j > k1 - 14 && j <= k1) { menuActionText[menuActionRow] = "Accept trade @whi@" + s; menuActionTypes[menuActionRow] = 484; @@ -6571,8 +6195,7 @@ private void buildDuelorTrade(int j) { } l++; } - if (chatTypeView == 4 && j1 == 8 - && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) { + if (chatTypeView == 4 && j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) { if (j > k1 - 14 && j <= k1) { menuActionText[menuActionRow] = "Accept challenge @whi@" + s; menuActionTypes[menuActionRow] = 6; @@ -6625,8 +6248,7 @@ private void buildChatAreaMenu(int j) { } if (j1 == 0) l++; - if ((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 - || publicChatMode == 1 && isFriendOrSelf(s))) { + if ((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) { if (j > k1 - 14 && j <= k1 && !s.equals(localPlayer.name)) { if (myPrivilege >= 1) { menuActionText[menuActionRow] = "Report abuse @whi@" + s; @@ -6643,8 +6265,7 @@ private void buildChatAreaMenu(int j) { l++; } if ((j1 == 3 || j1 == 7) && splitPrivateChat == 0 - && (j1 == 7 || privateChatMode == 0 - || privateChatMode == 1 && isFriendOrSelf(s))) { + && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) { if (j > k1 - 14 && j <= k1) { if (myPrivilege >= 1) { menuActionText[menuActionRow] = "Report abuse @whi@" + s; @@ -6748,9 +6369,13 @@ private void drawFriendsListOrWelcomeScreen(Widget widget) { if (friendsNodeIDs[index] == 0) widget.defaultText = "@red@Offline"; else if (friendsNodeIDs[index] == nodeID) - widget.defaultText = "@gre@Online"/* + (friendsNodeIDs[j] - 9) */; + widget.defaultText = "@gre@Online"/* + * + (friendsNodeIDs[j] - 9) + */; else - widget.defaultText = "@red@Offline"/* + (friendsNodeIDs[j] - 9) */; + widget.defaultText = "@red@Offline"/* + * + (friendsNodeIDs[j] - 9) + */; widget.atActionType = 1; return; } @@ -6783,8 +6408,7 @@ else if (friendsNodeIDs[index] == nodeID) widget.atActionType = 0; return; } else { - widget.defaultText = StringUtils.formatText( - StringUtils.decodeBase37(ignoreListAsLongs[index])); + widget.defaultText = StringUtils.formatText(StringUtils.decodeBase37(ignoreListAsLongs[index])); widget.atActionType = 1; return; } @@ -6797,7 +6421,7 @@ else if (friendsNodeIDs[index] == nodeID) } if (index == 327) { widget.modelRotation1 = 150; - widget.modelRotation2 = (int) (Math.sin((double) tick / 40D) * 256D) & 0x7ff; + widget.modelRotation2 = (int) (Math.sin(tick / 40D) * 256D) & 0x7ff; if (aBoolean1031) { for (int k1 = 0; k1 < 7; k1++) { int l1 = anIntArray1065[k1]; @@ -6811,8 +6435,7 @@ else if (friendsNodeIDs[index] == nodeID) for (int j2 = 0; j2 < 7; j2++) { int k2 = anIntArray1065[j2]; if (k2 >= 0) - aclass30_sub2_sub4_sub6s[i2++] = - IdentityKit.kits[k2].bodyModel(); + aclass30_sub2_sub4_sub6s[i2++] = IdentityKit.kits[k2].bodyModel(); } Model model = new Model(i2, aclass30_sub2_sub4_sub6s); @@ -6821,8 +6444,7 @@ else if (friendsNodeIDs[index] == nodeID) model.recolor(PLAYER_BODY_RECOLOURS[l2][0], PLAYER_BODY_RECOLOURS[l2][characterDesignColours[l2]]); if (l2 == 1) - model.recolor(anIntArray1204[0], - anIntArray1204[characterDesignColours[l2]]); + model.recolor(anIntArray1204[0], anIntArray1204[characterDesignColours[l2]]); } model.skin(); @@ -6837,7 +6459,7 @@ else if (friendsNodeIDs[index] == nodeID) if (index == 328) { Widget rsInterface = widget; int verticleTilt = 150; - int animationSpeed = (int) (Math.sin((double) tick / 40D) * 256D) & 0x7ff; + int animationSpeed = (int) (Math.sin(tick / 40D) * 256D) & 0x7ff; rsInterface.modelRotation1 = verticleTilt; rsInterface.modelRotation2 = animationSpeed; if (aBoolean1031) { @@ -6847,8 +6469,7 @@ else if (friendsNodeIDs[index] == nodeID) characterDisplay.recolor(PLAYER_BODY_RECOLOURS[l2][0], PLAYER_BODY_RECOLOURS[l2][characterDesignColours[l2]]); if (l2 == 1) - characterDisplay.recolor(anIntArray1204[0], - anIntArray1204[characterDesignColours[l2]]); + characterDisplay.recolor(anIntArray1204[0], anIntArray1204[characterDesignColours[l2]]); } int staticFrame = localPlayer.idleAnimation; characterDisplay.skin(); @@ -6900,12 +6521,10 @@ else if (friendsNodeIDs[index] == nodeID) if (myPrivilege >= 1) { if (canMute) { widget.textColor = 0xff0000; - widget.defaultText = - "Moderator option: Mute player for 48 hours: "; + widget.defaultText = "Moderator option: Mute player for 48 hours: "; } else { widget.textColor = 0xffffff; - widget.defaultText = - "Moderator option: Mute player for 48 hours: "; + widget.defaultText = "Moderator option: Mute player for 48 hours: "; } } else { widget.defaultText = ""; @@ -6940,13 +6559,11 @@ else if (daysSinceLastLogin == 1) if (index == 652) if (daysSinceRecovChange == 201) { if (membersInt == 1) - widget.defaultText = - "@yel@This is a non-members world: @whi@Since you are a member we"; + widget.defaultText = "@yel@This is a non-members world: @whi@Since you are a member we"; else widget.defaultText = ""; } else if (daysSinceRecovChange == 200) { - widget.defaultText = - "You have not yet set any password recovery questions."; + widget.defaultText = "You have not yet set any password recovery questions."; } else { String s1; if (daysSinceRecovChange == 0) @@ -6960,33 +6577,27 @@ else if (daysSinceRecovChange == 1) if (index == 653) if (daysSinceRecovChange == 201) { if (membersInt == 1) - widget.defaultText = - "@whi@recommend you use a members world instead. You may use"; + widget.defaultText = "@whi@recommend you use a members world instead. You may use"; else widget.defaultText = ""; } else if (daysSinceRecovChange == 200) - widget.defaultText = - "We strongly recommend you do so now to secure your account."; + widget.defaultText = "We strongly recommend you do so now to secure your account."; else - widget.defaultText = - "If you do not remember making this change then cancel it immediately"; + widget.defaultText = "If you do not remember making this change then cancel it immediately"; if (index == 654) { if (daysSinceRecovChange == 201) if (membersInt == 1) { - widget.defaultText = - "@whi@this world but member benefits are unavailable whilst here."; + widget.defaultText = "@whi@this world but member benefits are unavailable whilst here."; return; } else { widget.defaultText = ""; return; } if (daysSinceRecovChange == 200) { - widget.defaultText = - "Do this from the 'account management' area on our front webpage"; + widget.defaultText = "Do this from the 'account management' area on our front webpage"; return; } - widget.defaultText = - "Do this from the 'account management' area on our front webpage"; + widget.defaultText = "Do this from the 'account management' area on our front webpage"; } } @@ -7012,8 +6623,8 @@ private void drawSplitPrivateChat() { s = s.substring(5); byte1 = 2; } - if ((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 - || privateChatMode == 1 && isFriendOrSelf(s))) { + if ((k == 3 || k == 7) + && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) { int l = 329 - i * 13; if (frameMode != ScreenMode.FIXED) { l = frameHeight - 170 - i * 13; @@ -7053,8 +6664,7 @@ private void drawSplitPrivateChat() { j1 = frameHeight - 170 - i * 13; } textDrawingArea.render(0, "To " + s + ": " + chatMessages[j], j1, 4); - textDrawingArea.render(65535, "To " + s + ": " + chatMessages[j], - j1 - 1, 4); + textDrawingArea.render(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4); if (++i >= 5) { return; } @@ -7074,7 +6684,7 @@ public void sendMessage(String message, int type, String name) { updateChatbox = true; } - for (int index = 499; index > 0; index--) { + for (int index = 499; index > 0; index--) { chatTypes[index] = chatTypes[index - 1]; chatNames[index] = chatNames[index - 1]; chatMessages[index] = chatMessages[index - 1]; @@ -7095,61 +6705,43 @@ public static void setTab(int id) { private final void minimapHovers() { final boolean fixed = frameMode == ScreenMode.FIXED; hpHover = fixed - ? hpHover = super.mouseX >= 516 && super.mouseX <= 571 && super.mouseY >= 41 - && super.mouseY < 72 - : super.mouseX >= frameWidth - 216 && super.mouseX <= 159 - && super.mouseY >= 13 && super.mouseY < 47; - prayHover = fixed - ? prayHover = super.mouseX >= 518 && super.mouseX <= 572 - && super.mouseY >= 85 && super.mouseY < 117 - : super.mouseX >= frameWidth - 207 && super.mouseX <= frameWidth - 151 - && super.mouseY >= 105 && super.mouseY < 139; - runHover = fixed - ? runHover = super.mouseX >= 540 && super.mouseX <= 593 - && super.mouseY >= 123 && super.mouseY < 154 - : super.mouseX >= frameWidth - 174 && super.mouseX <= frameWidth - 120 - && super.mouseY >= 132 && super.mouseY < 165; - worldHover = fixed - ? super.mouseX >= 718 && super.mouseX <= 748 && super.mouseY >= 22 - && super.mouseY <= 50 - : super.mouseX >= frameWidth - 117 && super.mouseX <= frameWidth - 86 - && super.mouseY >= 153 && super.mouseY <= 186; - specialHover = fixed - ? super.mouseX >= 670 && super.mouseX <= 727 && super.mouseY >= 133 - && super.mouseY <= 164 - : super.mouseX >= frameWidth - 62 && super.mouseX <= frameWidth - 5 - && super.mouseY >= 151 && super.mouseY <= 184; - } - - private final int[] tabClickX = {38, 33, 33, 33, 33, 33, 38, 38, 33, 33, 33, 33, 33, 38}, - tabClickStart = {522, 560, 593, 625, 659, 692, 724, 522, 560, 593, 625, 659, 692, - 724}, - tabClickY = {169, 169, 169, 169, 169, 169, 169, 466, 466, 466, 466, 466, 466, - 466}; + ? hpHover = super.mouseX >= 516 && super.mouseX <= 571 && super.mouseY >= 41 && super.mouseY < 72 + : super.mouseX >= frameWidth - 216 && super.mouseX <= 159 && super.mouseY >= 13 && super.mouseY < 47; + prayHover = fixed + ? prayHover = super.mouseX >= 518 && super.mouseX <= 572 && super.mouseY >= 85 && super.mouseY < 117 + : super.mouseX >= frameWidth - 207 && super.mouseX <= frameWidth - 151 && super.mouseY >= 105 + && super.mouseY < 139; + runHover = fixed + ? runHover = super.mouseX >= 540 && super.mouseX <= 593 && super.mouseY >= 123 && super.mouseY < 154 + : super.mouseX >= frameWidth - 174 && super.mouseX <= frameWidth - 120 && super.mouseY >= 132 + && super.mouseY < 165; + worldHover = fixed ? super.mouseX >= 718 && super.mouseX <= 748 && super.mouseY >= 22 && super.mouseY <= 50 + : super.mouseX >= frameWidth - 117 && super.mouseX <= frameWidth - 86 && super.mouseY >= 153 + && super.mouseY <= 186; + } + + private final int[] tabClickX = { 38, 33, 33, 33, 33, 33, 38, 38, 33, 33, 33, 33, 33, 38 }, + tabClickStart = { 522, 560, 593, 625, 659, 692, 724, 522, 560, 593, 625, 659, 692, 724 }, + tabClickY = { 169, 169, 169, 169, 169, 169, 169, 466, 466, 466, 466, 466, 466, 466 }; private void processTabClick() { if (super.clickMode3 == 1) { - if (frameMode == ScreenMode.FIXED - || frameMode != ScreenMode.FIXED && !changeTabArea) { + if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) { int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 765; int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 503; for (int i = 0; i < tabClickX.length; i++) { if (super.mouseX >= tabClickStart[i] + xOffset - && super.mouseX <= tabClickStart[i] + tabClickX[i] - + xOffset - && super.mouseY >= tabClickY[i] + yOffset - && super.mouseY < tabClickY[i] + 37 + yOffset - && tabInterfaceIDs[i] != -1) { + && super.mouseX <= tabClickStart[i] + tabClickX[i] + xOffset + && super.mouseY >= tabClickY[i] + yOffset && super.mouseY < tabClickY[i] + 37 + yOffset + && tabInterfaceIDs[i] != -1) { tabId = i; tabAreaAltered = true; break; } } } else if (changeTabArea && frameWidth < 1000) { - if (super.saveClickX >= frameWidth - 226 - && super.saveClickX <= frameWidth - 195 - && super.saveClickY >= frameHeight - 72 - && super.saveClickY < frameHeight - 40 + if (super.saveClickX >= frameWidth - 226 && super.saveClickX <= frameWidth - 195 + && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[0] != -1) { if (tabId == 0) { showTabComponents = !showTabComponents; @@ -7160,10 +6752,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 194 - && super.saveClickX <= frameWidth - 163 - && super.saveClickY >= frameHeight - 72 - && super.saveClickY < frameHeight - 40 + if (super.saveClickX >= frameWidth - 194 && super.saveClickX <= frameWidth - 163 + && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[1] != -1) { if (tabId == 1) { showTabComponents = !showTabComponents; @@ -7174,10 +6764,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 162 - && super.saveClickX <= frameWidth - 131 - && super.saveClickY >= frameHeight - 72 - && super.saveClickY < frameHeight - 40 + if (super.saveClickX >= frameWidth - 162 && super.saveClickX <= frameWidth - 131 + && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[2] != -1) { if (tabId == 2) { showTabComponents = !showTabComponents; @@ -7188,10 +6776,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 129 - && super.saveClickX <= frameWidth - 98 - && super.saveClickY >= frameHeight - 72 - && super.saveClickY < frameHeight - 40 + if (super.saveClickX >= frameWidth - 129 && super.saveClickX <= frameWidth - 98 + && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[3] != -1) { if (tabId == 3) { showTabComponents = !showTabComponents; @@ -7202,10 +6788,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 97 - && super.saveClickX <= frameWidth - 66 - && super.saveClickY >= frameHeight - 72 - && super.saveClickY < frameHeight - 40 + if (super.saveClickX >= frameWidth - 97 && super.saveClickX <= frameWidth - 66 + && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[4] != -1) { if (tabId == 4) { showTabComponents = !showTabComponents; @@ -7216,10 +6800,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 65 - && super.saveClickX <= frameWidth - 34 - && super.saveClickY >= frameHeight - 72 - && super.saveClickY < frameHeight - 40 + if (super.saveClickX >= frameWidth - 65 && super.saveClickX <= frameWidth - 34 + && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[5] != -1) { if (tabId == 5) { showTabComponents = !showTabComponents; @@ -7231,8 +6813,7 @@ private void processTabClick() { } if (super.saveClickX >= frameWidth - 33 && super.saveClickX <= frameWidth - && super.saveClickY >= frameHeight - 72 - && super.saveClickY < frameHeight - 40 + && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[6] != -1) { if (tabId == 6) { showTabComponents = !showTabComponents; @@ -7244,10 +6825,8 @@ private void processTabClick() { } - if (super.saveClickX >= frameWidth - 194 - && super.saveClickX <= frameWidth - 163 - && super.saveClickY >= frameHeight - 37 - && super.saveClickY < frameHeight - 0 + if (super.saveClickX >= frameWidth - 194 && super.saveClickX <= frameWidth - 163 + && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[8] != -1) { if (tabId == 8) { showTabComponents = !showTabComponents; @@ -7258,10 +6837,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 162 - && super.saveClickX <= frameWidth - 131 - && super.saveClickY >= frameHeight - 37 - && super.saveClickY < frameHeight - 0 + if (super.saveClickX >= frameWidth - 162 && super.saveClickX <= frameWidth - 131 + && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[9] != -1) { if (tabId == 9) { showTabComponents = !showTabComponents; @@ -7272,10 +6849,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 129 - && super.saveClickX <= frameWidth - 98 - && super.saveClickY >= frameHeight - 37 - && super.saveClickY < frameHeight - 0 + if (super.saveClickX >= frameWidth - 129 && super.saveClickX <= frameWidth - 98 + && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[10] != -1) { if (tabId == 7) { showTabComponents = !showTabComponents; @@ -7286,10 +6861,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 97 - && super.saveClickX <= frameWidth - 66 - && super.saveClickY >= frameHeight - 37 - && super.saveClickY < frameHeight - 0 + if (super.saveClickX >= frameWidth - 97 && super.saveClickX <= frameWidth - 66 + && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[11] != -1) { if (tabId == 11) { showTabComponents = !showTabComponents; @@ -7300,10 +6873,8 @@ private void processTabClick() { tabAreaAltered = true; } - if (super.saveClickX >= frameWidth - 65 - && super.saveClickX <= frameWidth - 34 - && super.saveClickY >= frameHeight - 37 - && super.saveClickY < frameHeight - 0 + if (super.saveClickX >= frameWidth - 65 && super.saveClickX <= frameWidth - 34 + && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[12] != -1) { if (tabId == 12) { showTabComponents = !showTabComponents; @@ -7315,8 +6886,7 @@ private void processTabClick() { } if (super.saveClickX >= frameWidth - 33 && super.saveClickX <= frameWidth - && super.saveClickY >= frameHeight - 37 - && super.saveClickY < frameHeight - 0 + && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[13] != -1) { if (tabId == 13) { showTabComponents = !showTabComponents; @@ -7329,8 +6899,7 @@ private void processTabClick() { } } else if (changeTabArea && frameWidth >= 1000) { if (super.mouseY >= frameHeight - 37 && super.mouseY <= frameHeight) { - if (super.mouseX >= frameWidth - 417 - && super.mouseX <= frameWidth - 386) { + if (super.mouseX >= frameWidth - 417 && super.mouseX <= frameWidth - 386) { if (tabId == 0) { showTabComponents = !showTabComponents; } else { @@ -7339,8 +6908,7 @@ private void processTabClick() { tabId = 0; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 385 - && super.mouseX <= frameWidth - 354) { + if (super.mouseX >= frameWidth - 385 && super.mouseX <= frameWidth - 354) { if (tabId == 1) { showTabComponents = !showTabComponents; } else { @@ -7349,8 +6917,7 @@ private void processTabClick() { tabId = 1; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 353 - && super.mouseX <= frameWidth - 322) { + if (super.mouseX >= frameWidth - 353 && super.mouseX <= frameWidth - 322) { if (tabId == 2) { showTabComponents = !showTabComponents; } else { @@ -7359,8 +6926,7 @@ private void processTabClick() { tabId = 2; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 321 - && super.mouseX <= frameWidth - 290) { + if (super.mouseX >= frameWidth - 321 && super.mouseX <= frameWidth - 290) { if (tabId == 3) { showTabComponents = !showTabComponents; } else { @@ -7369,8 +6935,7 @@ private void processTabClick() { tabId = 3; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 289 - && super.mouseX <= frameWidth - 258) { + if (super.mouseX >= frameWidth - 289 && super.mouseX <= frameWidth - 258) { if (tabId == 4) { showTabComponents = !showTabComponents; } else { @@ -7379,8 +6944,7 @@ private void processTabClick() { tabId = 4; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 257 - && super.mouseX <= frameWidth - 226) { + if (super.mouseX >= frameWidth - 257 && super.mouseX <= frameWidth - 226) { if (tabId == 5) { showTabComponents = !showTabComponents; } else { @@ -7389,8 +6953,7 @@ private void processTabClick() { tabId = 5; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 225 - && super.mouseX <= frameWidth - 194) { + if (super.mouseX >= frameWidth - 225 && super.mouseX <= frameWidth - 194) { if (tabId == 6) { showTabComponents = !showTabComponents; } else { @@ -7399,8 +6962,7 @@ private void processTabClick() { tabId = 6; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 193 - && super.mouseX <= frameWidth - 163) { + if (super.mouseX >= frameWidth - 193 && super.mouseX <= frameWidth - 163) { if (tabId == 8) { showTabComponents = !showTabComponents; } else { @@ -7409,8 +6971,7 @@ private void processTabClick() { tabId = 8; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 162 - && super.mouseX <= frameWidth - 131) { + if (super.mouseX >= frameWidth - 162 && super.mouseX <= frameWidth - 131) { if (tabId == 9) { showTabComponents = !showTabComponents; } else { @@ -7419,8 +6980,7 @@ private void processTabClick() { tabId = 9; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 130 - && super.mouseX <= frameWidth - 99) { + if (super.mouseX >= frameWidth - 130 && super.mouseX <= frameWidth - 99) { if (tabId == 7) { showTabComponents = !showTabComponents; } else { @@ -7429,8 +6989,7 @@ private void processTabClick() { tabId = 7; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 98 - && super.mouseX <= frameWidth - 67) { + if (super.mouseX >= frameWidth - 98 && super.mouseX <= frameWidth - 67) { if (tabId == 11) { showTabComponents = !showTabComponents; } else { @@ -7439,8 +6998,7 @@ private void processTabClick() { tabId = 11; tabAreaAltered = true; } - if (super.mouseX >= frameWidth - 66 - && super.mouseX <= frameWidth - 45) { + if (super.mouseX >= frameWidth - 66 && super.mouseX <= frameWidth - 45) { if (tabId == 12) { showTabComponents = !showTabComponents; } else { @@ -7577,7 +7135,7 @@ public void processRightClick() { } anInt886 = 0; anInt1315 = 0; - if (frameMode == ScreenMode.FIXED ) { + if (frameMode == ScreenMode.FIXED) { if (super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516 && super.mouseY < 338) { if (openInterfaceId != -1) { buildInterfaceMenu(4, Widget.interfaceCache[openInterfaceId], super.mouseX, 4, super.mouseY, 0); @@ -7585,10 +7143,13 @@ public void processRightClick() { createMenu(); } } - } else if (frameMode != ScreenMode.FIXED ) { + } else if (frameMode != ScreenMode.FIXED) { if (getMousePositions()) { - if (super.mouseX > (frameWidth / 2) - 356 && super.mouseY > (frameHeight / 2) - 230 && super.mouseX < ((frameWidth / 2) + 356) && super.mouseY < (frameHeight / 2) + 230 && openInterfaceId != -1) { - buildInterfaceMenu((frameWidth / 2) - 356, Widget.interfaceCache[openInterfaceId], super.mouseX, (frameHeight / 2) - 230, super.mouseY, 0); + if (super.mouseX > (frameWidth / 2) - 356 && super.mouseY > (frameHeight / 2) - 230 + && super.mouseX < ((frameWidth / 2) + 356) && super.mouseY < (frameHeight / 2) + 230 + && openInterfaceId != -1) { + buildInterfaceMenu((frameWidth / 2) - 356, Widget.interfaceCache[openInterfaceId], super.mouseX, + (frameHeight / 2) - 230, super.mouseY, 0); } else { createMenu(); } @@ -7605,32 +7166,26 @@ public void processRightClick() { if (!changeTabArea) { final int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 503; final int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 765; - if (super.mouseX > 548 + xOffset && super.mouseX < 740 + xOffset - && super.mouseY > 207 + yOffset && super.mouseY < 468 + yOffset) { + if (super.mouseX > 548 + xOffset && super.mouseX < 740 + xOffset && super.mouseY > 207 + yOffset + && super.mouseY < 468 + yOffset) { if (overlayInterfaceId != -1) { - buildInterfaceMenu(548 + xOffset, - Widget.interfaceCache[overlayInterfaceId], super.mouseX, + buildInterfaceMenu(548 + xOffset, Widget.interfaceCache[overlayInterfaceId], super.mouseX, 207 + yOffset, super.mouseY, 0); } else if (tabInterfaceIDs[tabId] != -1) { - buildInterfaceMenu(548 + xOffset, - Widget.interfaceCache[tabInterfaceIDs[tabId]], - super.mouseX, 207 + yOffset, super.mouseY, 0); + buildInterfaceMenu(548 + xOffset, Widget.interfaceCache[tabInterfaceIDs[tabId]], super.mouseX, + 207 + yOffset, super.mouseY, 0); } } } else if (changeTabArea) { final int yOffset = frameWidth >= 1000 ? 37 : 74; if (super.mouseX > frameWidth - 197 && super.mouseY > frameHeight - yOffset - 267 - && super.mouseX < frameWidth - 7 - && super.mouseY < frameHeight - yOffset - 7 && showTabComponents) { + && super.mouseX < frameWidth - 7 && super.mouseY < frameHeight - yOffset - 7 && showTabComponents) { if (overlayInterfaceId != -1) { - buildInterfaceMenu(frameWidth - 197, - Widget.interfaceCache[overlayInterfaceId], super.mouseX, + buildInterfaceMenu(frameWidth - 197, Widget.interfaceCache[overlayInterfaceId], super.mouseX, frameHeight - yOffset - 267, super.mouseY, 0); } else if (tabInterfaceIDs[tabId] != -1) { - buildInterfaceMenu(frameWidth - 197, - Widget.interfaceCache[tabInterfaceIDs[tabId]], - super.mouseX, frameHeight - yOffset - 267, super.mouseY, - 0); + buildInterfaceMenu(frameWidth - 197, Widget.interfaceCache[tabInterfaceIDs[tabId]], super.mouseX, + frameHeight - yOffset - 267, super.mouseY, 0); } } } @@ -7644,22 +7199,16 @@ public void processRightClick() { } anInt886 = 0; anInt1315 = 0; - if (super.mouseX > 0 - && super.mouseY > (frameMode == ScreenMode.FIXED ? 338 : frameHeight - 165) - && super.mouseX < 490 - && super.mouseY < (frameMode == ScreenMode.FIXED ? 463 : frameHeight - 40) - && showChatComponents) { - if (backDialogueId != -1) { - - - buildInterfaceMenu(20, Widget.interfaceCache[backDialogueId], super.mouseX, (frameMode == ScreenMode.FIXED ? 358 : frameHeight - 145), super.mouseY, 0); - + if (super.mouseX > 0 && super.mouseY > (frameMode == ScreenMode.FIXED ? 338 : frameHeight - 165) + && super.mouseX < 490 && super.mouseY < (frameMode == ScreenMode.FIXED ? 463 : frameHeight - 40) + && showChatComponents) { + if (backDialogueId != -1) { + buildInterfaceMenu(20, Widget.interfaceCache[backDialogueId], super.mouseX, + (frameMode == ScreenMode.FIXED ? 358 : frameHeight - 145), super.mouseY, 0); - } else if (super.mouseY < (frameMode == ScreenMode.FIXED ? 463 : frameHeight - 40) - && super.mouseX < 490) { - buildChatAreaMenu(super.mouseY - - (frameMode == ScreenMode.FIXED ? 338 : frameHeight - 165)); + } else if (super.mouseY < (frameMode == ScreenMode.FIXED ? 463 : frameHeight - 40) && super.mouseX < 490) { + buildChatAreaMenu(super.mouseY - (frameMode == ScreenMode.FIXED ? 338 : frameHeight - 165)); } } if (backDialogueId != -1 && anInt886 != anInt1039) { @@ -7670,8 +7219,7 @@ public void processRightClick() { updateChatbox = true; anInt1500 = anInt1315; } - if (super.mouseX > 4 && super.mouseY > 480 && super.mouseX < 516 - && super.mouseY < frameHeight) { + if (super.mouseX > 4 && super.mouseY > 480 && super.mouseX < 516 && super.mouseY < frameHeight) { rightClickChatButtons(); } processMinimapActions(); @@ -7710,19 +7258,22 @@ private int method83(int i, int j, int k) { /** * The login method for the 317 protocol. * - * @param name The name of the user trying to login. - * @param password The password of the user trying to login. - * @param reconnecting The flag for the user indicating to attempt to reconnect. + * @param name + * The name of the user trying to login. + * @param password + * The password of the user trying to login. + * @param reconnecting + * The flag for the user indicating to attempt to reconnect. */ private void login(String name, String password, boolean reconnecting) { SignLink.setError(name); try { - if(name.length() < 3) { + if (name.length() < 3) { firstLoginMessage = ""; secondLoginMessage = "Your username is too short."; return; } - if(password.length() < 3) { + if (password.length() < 3) { firstLoginMessage = ""; secondLoginMessage = "Your password is too short."; return; @@ -7734,19 +7285,16 @@ private void login(String name, String password, boolean reconnecting) { } outgoing = ByteBuffer.create(5000, false, null); - socketStream = new BufferedConnection(this, - openSocket(Configuration.server_port + portOffset)); + socketStream = new BufferedConnection(this, openSocket(Configuration.server_port + portOffset)); - - outgoing.putByte(14); //REQUEST + outgoing.putByte(14); // REQUEST socketStream.queueBytes(1, outgoing.getBuffer()); - int response = socketStream.read(); int copy = response; - //Our encryption for outgoing messages for this player's session + // Our encryption for outgoing messages for this player's session IsaacCipher cipher = null; if (response == 0) { @@ -7771,12 +7319,13 @@ private void login(String name, String password, boolean reconnecting) { login.currentPosition = 0; login.writeByte(reconnecting ? 18 : 16); - login.writeByte(outgoing.getPosition() + 1 + 1 + 2); // size of the + login.writeByte(outgoing.getPosition() + 1 + 1 + 2); // size of + // the // login block login.writeByte(255); login.writeShort(1); login.writeByte(lowMemory ? 1 : 0); // client version - login.writeBytes(outgoing.getBuffer(), outgoing.getPosition(), 0); + login.writeBytes(outgoing.getBuffer(), outgoing.getPosition(), 0); cipher = new IsaacCipher(seed); for (int index = 0; index < 4; index++) seed[index] += 50; @@ -7798,7 +7347,7 @@ private void login(String name, String password, boolean reconnecting) { } if (response == 2) { myPrivilege = socketStream.read(); - //flagged = socketStream.read() == 1; + // flagged = socketStream.read() == 1; aLong1220 = 0L; mouseDetection.coordsIndex = 0; super.awtFocus = true; @@ -7978,8 +7527,7 @@ private void login(String name, String password, boolean reconnecting) { if (response == 21) { for (int k1 = socketStream.read(); k1 >= 0; k1--) { firstLoginMessage = "You have only just left another world"; - secondLoginMessage = - "Your profile will be transferred in: " + k1 + " seconds"; + secondLoginMessage = "Your profile will be transferred in: " + k1 + " seconds"; drawLoginScreen(true); try { Thread.sleep(1000L); @@ -8028,8 +7576,8 @@ private void login(String name, String password, boolean reconnecting) { secondLoginMessage = "Error connecting to server."; } - private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, - boolean flag, int k2) { + private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag, + int k2) { try { byte byte0 = 104; byte byte1 = 104; @@ -8059,8 +7607,7 @@ private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, break; } if (i1 != 0) { - if ((i1 < 5 || i1 == 10) - && collisionMaps[plane].method219(k2, j3, k3, j, i1 - 1, i2)) { + if ((i1 < 5 || i1 == 10) && collisionMaps[plane].method219(k2, j3, k3, j, i1 - 1, i2)) { flag1 = true; break; } @@ -8069,48 +7616,41 @@ private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, break; } } - if (k1 != 0 && k != 0 - && collisionMaps[plane].method221(i2, k2, j3, k, l1, k1, k3)) { + if (k1 != 0 && k != 0 && collisionMaps[plane].method221(i2, k2, j3, k, l1, k1, k3)) { flag1 = true; break; } int l4 = anIntArrayArray825[j3][k3] + 1; - if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 - && (ai[j3 - 1][k3] & 0x1280108) == 0) { + if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0) { bigX[l3] = j3 - 1; bigY[l3] = k3; l3 = (l3 + 1) % j4; anIntArrayArray901[j3 - 1][k3] = 2; anIntArrayArray825[j3 - 1][k3] = l4; } - if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 - && (ai[j3 + 1][k3] & 0x1280180) == 0) { + if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0) { bigX[l3] = j3 + 1; bigY[l3] = k3; l3 = (l3 + 1) % j4; anIntArrayArray901[j3 + 1][k3] = 8; anIntArrayArray825[j3 + 1][k3] = l4; } - if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 - && (ai[j3][k3 - 1] & 0x1280102) == 0) { + if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) { bigX[l3] = j3; bigY[l3] = k3 - 1; l3 = (l3 + 1) % j4; anIntArrayArray901[j3][k3 - 1] = 1; anIntArrayArray825[j3][k3 - 1] = l4; } - if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 - && (ai[j3][k3 + 1] & 0x1280120) == 0) { + if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) { bigX[l3] = j3; bigY[l3] = k3 + 1; l3 = (l3 + 1) % j4; anIntArrayArray901[j3][k3 + 1] = 4; anIntArrayArray825[j3][k3 + 1] = l4; } - if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0 - && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0 - && (ai[j3 - 1][k3] & 0x1280108) == 0 - && (ai[j3][k3 - 1] & 0x1280102) == 0) { + if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0 && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0 + && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) { bigX[l3] = j3 - 1; bigY[l3] = k3 - 1; l3 = (l3 + 1) % j4; @@ -8118,8 +7658,7 @@ private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, anIntArrayArray825[j3 - 1][k3 - 1] = l4; } if (j3 < byte0 - 1 && k3 > 0 && anIntArrayArray901[j3 + 1][k3 - 1] == 0 - && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0 - && (ai[j3 + 1][k3] & 0x1280180) == 0 + && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) { bigX[l3] = j3 + 1; bigY[l3] = k3 - 1; @@ -8128,8 +7667,7 @@ private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, anIntArrayArray825[j3 + 1][k3 - 1] = l4; } if (j3 > 0 && k3 < byte1 - 1 && anIntArrayArray901[j3 - 1][k3 + 1] == 0 - && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0 - && (ai[j3 - 1][k3] & 0x1280108) == 0 + && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) { bigX[l3] = j3 - 1; bigY[l3] = k3 + 1; @@ -8138,8 +7676,7 @@ private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, anIntArrayArray825[j3 - 1][k3 + 1] = l4; } if (j3 < byte0 - 1 && k3 < byte1 - 1 && anIntArrayArray901[j3 + 1][k3 + 1] == 0 - && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0 - && (ai[j3 + 1][k3] & 0x1280180) == 0 + && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) { bigX[l3] = j3 + 1; bigY[l3] = k3 + 1; @@ -8155,8 +7692,7 @@ private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, for (int k5 = 1; k5 < 2; k5++) { for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) { for (int l6 = i2 - k5; l6 <= i2 + k5; l6++) { - if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 - && anIntArrayArray825[i6][l6] < i5) { + if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5) { i5 = anIntArrayArray825[i6][l6]; j3 = i6; k3 = l6; @@ -8176,8 +7712,7 @@ private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, bigX[i4] = j3; bigY[i4++] = k3; int l5; - for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = - anIntArrayArray901[j3][k3]) { + for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) { if (j5 != l5) { l5 = j5; bigX[i4] = j3; @@ -8201,13 +7736,15 @@ else if ((j5 & 4) != 0) int i7 = bigY[i4]; anInt1288 += k4; if (anInt1288 >= 92) { - /*Anti-cheatValidates, walking. Not used. OUTPUT_BUFFER.createFrame(36); - OUTPUT_BUFFER.writeDWord(0);*/ + /* + * Anti-cheatValidates, walking. Not used. + * OUTPUT_BUFFER.createFrame(36); + * OUTPUT_BUFFER.writeDWord(0); + */ anInt1288 = 0; } sendPacket(new UpdatePlane(plane)); - final int k5 = k4; final int i_4 = i4; final int keyArr = super.keyArray[5] != 1 ? 0 : 1; @@ -8245,7 +7782,7 @@ public void buildPacket(ByteBuffer buf) { return true; } - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } return type != 1; @@ -8285,7 +7822,7 @@ private void npcUpdateMask(Buffer stream) { int damage = stream.readShort(); int type = stream.readUnsignedByte(); int hp = stream.readShort(); - int maxHp = stream.readShort(); + int maxHp = stream.readShort(); npc.updateHitData(type, damage, tick); npc.loopCycleStatus = tick + 300; npc.currentHealth = hp; @@ -8295,13 +7832,13 @@ private void npcUpdateMask(Buffer stream) { npc.graphic = stream.readUShort(); int k1 = stream.readInt(); npc.graphicHeight = k1 >> 16; - npc.graphicDelay = tick + (k1 & 0xffff); - npc.currentAnimation = 0; - npc.anInt1522 = 0; - if (npc.graphicDelay > tick) - npc.currentAnimation = -1; - if (npc.graphic == 65535) - npc.graphic = -1; + npc.graphicDelay = tick + (k1 & 0xffff); + npc.currentAnimation = 0; + npc.anInt1522 = 0; + if (npc.graphicDelay > tick) + npc.currentAnimation = -1; + if (npc.graphic == 65535) + npc.graphic = -1; } if ((mask & 0x20) != 0) { npc.interactingEntity = stream.readUShort(); @@ -8312,7 +7849,7 @@ private void npcUpdateMask(Buffer stream) { npc.spokenText = stream.readString(); npc.textCycle = 100; } - if ((mask & 0x40) != 0) { + if ((mask & 0x40) != 0) { int damage = stream.readShort(); int type = stream.readShort(); int hp = stream.readUnsignedByte(); @@ -8354,8 +7891,8 @@ private void buildAtNPCMenu(NpcDefinition entityDef, int i, int j, int k) { String s = entityDef.name; if (entityDef.combatLevel != 0) - s = s + combatDiffColor(localPlayer.combatLevel, entityDef.combatLevel) - + " (level-" + entityDef.combatLevel + ")"; + s = s + combatDiffColor(localPlayer.combatLevel, entityDef.combatLevel) + " (level-" + entityDef.combatLevel + + ")"; if (itemSelected == 1) { menuActionText[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s; menuActionTypes[menuActionRow] = 582; @@ -8377,10 +7914,8 @@ private void buildAtNPCMenu(NpcDefinition entityDef, int i, int j, int k) { } else { if (entityDef.actions != null) { for (int l = 4; l >= 0; l--) - if (entityDef.actions[l] != null - && !entityDef.actions[l].equalsIgnoreCase("attack")) { - menuActionText[menuActionRow] = - entityDef.actions[l] + " @yel@" + s; + if (entityDef.actions[l] != null && !entityDef.actions[l].equalsIgnoreCase("attack")) { + menuActionText[menuActionRow] = entityDef.actions[l] + " @yel@" + s; if (l == 0) menuActionTypes[menuActionRow] = 20; if (l == 1) @@ -8400,13 +7935,11 @@ private void buildAtNPCMenu(NpcDefinition entityDef, int i, int j, int k) { } if (entityDef.actions != null) { for (int i1 = 4; i1 >= 0; i1--) - if (entityDef.actions[i1] != null - && entityDef.actions[i1].equalsIgnoreCase("attack")) { + if (entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("attack")) { char c = '\0'; if (entityDef.combatLevel > localPlayer.combatLevel) c = '\u07D0'; - menuActionText[menuActionRow] = - entityDef.actions[i1] + " @yel@" + s; + menuActionText[menuActionRow] = entityDef.actions[i1] + " @yel@" + s; if (i1 == 0) menuActionTypes[menuActionRow] = 20 + c; if (i1 == 1) @@ -8425,8 +7958,8 @@ private void buildAtNPCMenu(NpcDefinition entityDef, int i, int j, int k) { } if (Configuration.enableIds && (myPrivilege >= 2 && myPrivilege <= 3)) { - menuActionText[menuActionRow] = "Examine @yel@" + s + " @gre@(@whi@" - + entityDef.interfaceType + "@gre@)"; + menuActionText[menuActionRow] = "Examine @yel@" + s + " @gre@(@whi@" + entityDef.interfaceType + + "@gre@)"; } else { menuActionText[menuActionRow] = "Examine @yel@" + s; } @@ -8448,8 +7981,8 @@ private void buildAtPlayerMenu(int i, int j, Player player, int k) { return; String s; if (player.skill == 0) - s = player.name + combatDiffColor(localPlayer.combatLevel, player.combatLevel) - + " (level-" + player.combatLevel + ")"; + s = player.name + combatDiffColor(localPlayer.combatLevel, player.combatLevel) + " (level-" + + player.combatLevel + ")"; else s = player.name + " (skill-" + player.skill + ")"; if (itemSelected == 1) { @@ -8469,7 +8002,7 @@ private void buildAtPlayerMenu(int i, int j, Player player, int k) { menuActionRow++; } } else { - for (int type = 4; type >= 0; type--) { + for (int type = 4; type >= 0; type--) { if (playerOptions[type] != null) { menuActionText[menuActionRow] = playerOptions[type] + " @whi@" + s; char c = '\0'; @@ -8506,7 +8039,7 @@ private void buildAtPlayerMenu(int i, int j, Player player, int k) { } } } - for (int row = 0; row < menuActionRow; row++) { + for (int row = 0; row < menuActionRow; row++) { if (menuActionTypes[row] == 519) { menuActionText[row] = "Walk here @whi@" + s; return; @@ -8522,25 +8055,23 @@ private void method89(SpawnedObject class30_sub1) { if (class30_sub1.group == 0) i = scene.getWallObjectUid(class30_sub1.plane, class30_sub1.x, class30_sub1.y); if (class30_sub1.group == 1) - i = scene.getWallDecorationUid(class30_sub1.plane, class30_sub1.x, - class30_sub1.y); + i = scene.getWallDecorationUid(class30_sub1.plane, class30_sub1.x, class30_sub1.y); if (class30_sub1.group == 2) - i = scene.getGameObjectUid(class30_sub1.plane, class30_sub1.x, - class30_sub1.y); + i = scene.getGameObjectUid(class30_sub1.plane, class30_sub1.x, class30_sub1.y); if (class30_sub1.group == 3) - i = scene.getGroundDecorationUid(class30_sub1.plane, class30_sub1.x, - class30_sub1.y); + i = scene.getGroundDecorationUid(class30_sub1.plane, class30_sub1.x, class30_sub1.y); if (i != 0) { int i1 = scene.getMask(class30_sub1.plane, class30_sub1.x, class30_sub1.y, i); j = i >> 14 & 0x7fff; - k = i1 & 0x1f; - l = i1 >> 6; + k = i1 & 0x1f; + l = i1 >> 6; } class30_sub1.getPreviousId = j; class30_sub1.previousType = k; class30_sub1.previousOrientation = l; } + @Override void startUp() { drawLoadingText(20, "Starting up"); if (SignLink.cache_dat != null) { @@ -8553,8 +8084,9 @@ void startUp() { Jaggrab.requestCrcs(); Jaggrab.preload(); } - - titleArchive = createArchive(Jaggrab.TITLE_CRC, "title screen", "title", Jaggrab.CRCs[Jaggrab.TITLE_CRC], 25); + + titleArchive = createArchive(Jaggrab.TITLE_CRC, "title screen", "title", Jaggrab.CRCs[Jaggrab.TITLE_CRC], + 25); smallText = new GameFont(false, "p11_full", titleArchive); regularText = new GameFont(false, "p12_full", titleArchive); boldText = new GameFont(false, "b12_full", titleArchive); @@ -8562,20 +8094,27 @@ void startUp() { newRegularFont = new RSFont(false, "p12_full", titleArchive); newBoldFont = new RSFont(false, "b12_full", titleArchive); newFancyFont = new RSFont(true, "q8_full", titleArchive); - gameFont = new GameFont(true, "q8_full", titleArchive); - + gameFont = new GameFont(true, "q8_full", titleArchive); + drawLogo(); loadTitleScreen(); - FileArchive configArchive = createArchive(Jaggrab.CONFIG_CRC, "config", "config", Jaggrab.CRCs[Jaggrab.CONFIG_CRC], 30); - FileArchive interfaceArchive = createArchive(Jaggrab.INTERFACE_CRC, "interface", "interface", Jaggrab.CRCs[Jaggrab.INTERFACE_CRC], 35); - FileArchive mediaArchive = createArchive(Jaggrab.MEDIA_CRC, "2d graphics", "media", Jaggrab.CRCs[Jaggrab.MEDIA_CRC], 40); - FileArchive streamLoader_6 = createArchive(Jaggrab.UPDATE_CRC, "update list", "versionlist", Jaggrab.CRCs[Jaggrab.UPDATE_CRC], 60); - this.mediaStreamLoader = mediaArchive; - FileArchive textureArchive = createArchive(Jaggrab.TEXTURES_CRC, "textures", "textures", Jaggrab.CRCs[Jaggrab.TEXTURES_CRC], 45); - FileArchive wordencArchive = createArchive(Jaggrab.CHAT_CRC, "chat system", "wordenc", Jaggrab.CRCs[Jaggrab.CHAT_CRC], 50); - - FileArchive soundArchive = createArchive(Jaggrab.SOUNDS_CRC, "sound effects", "sounds", Jaggrab.CRCs[Jaggrab.SOUNDS_CRC], 55); - + FileArchive configArchive = createArchive(Jaggrab.CONFIG_CRC, "config", "config", + Jaggrab.CRCs[Jaggrab.CONFIG_CRC], 30); + FileArchive interfaceArchive = createArchive(Jaggrab.INTERFACE_CRC, "interface", "interface", + Jaggrab.CRCs[Jaggrab.INTERFACE_CRC], 35); + FileArchive mediaArchive = createArchive(Jaggrab.MEDIA_CRC, "2d graphics", "media", + Jaggrab.CRCs[Jaggrab.MEDIA_CRC], 40); + FileArchive streamLoader_6 = createArchive(Jaggrab.UPDATE_CRC, "update list", "versionlist", + Jaggrab.CRCs[Jaggrab.UPDATE_CRC], 60); + this.mediaStreamLoader = mediaArchive; + FileArchive textureArchive = createArchive(Jaggrab.TEXTURES_CRC, "textures", "textures", + Jaggrab.CRCs[Jaggrab.TEXTURES_CRC], 45); + FileArchive wordencArchive = createArchive(Jaggrab.CHAT_CRC, "chat system", "wordenc", + Jaggrab.CRCs[Jaggrab.CHAT_CRC], 50); + + FileArchive soundArchive = createArchive(Jaggrab.SOUNDS_CRC, "sound effects", "sounds", + Jaggrab.CRCs[Jaggrab.SOUNDS_CRC], 55); + tileFlags = new byte[4][104][104]; tileHeights = new int[4][105][105]; scene = new SceneGraph(tileHeights); @@ -8583,14 +8122,14 @@ void startUp() { for (int j = 0; j < 4; j++) collisionMaps[j] = new CollisionMap(); - minimapImage = new Sprite(512, 512); + minimapImage = new Sprite(512, 512); drawLoadingText(60, "Connecting to update server"); Frame.animationlist = new Frame[3000][0]; resourceProvider = new ResourceProvider(); resourceProvider.initialize(streamLoader_6, this); Model.method459(resourceProvider.getModelCount(), resourceProvider); drawLoadingText(80, "Unpacking media"); - + byte soundData[] = soundArchive.readFile("sounds.dat"); Buffer stream = new Buffer(soundData); Track.unpack(stream); @@ -8637,7 +8176,8 @@ void startUp() { Sprite[] clanIcons = new Sprite[9]; for (int index = 0; index < clanIcons.length; index++) { - //clanIcons[index] = new Sprite("Interfaces/Clan Chat/Icons/" + index); + // clanIcons[index] = new Sprite("Interfaces/Clan Chat/Icons/" + + // index); } RSFont.unpackImages(modIcons, clanIcons); @@ -8703,7 +8243,7 @@ void startUp() { if (mapScenes[i6] != null) mapScenes[i6].offsetColor(i5 + l5, j5 + l5, k5 + l5); } - + drawLoadingText(83, "Unpacking textures"); Rasterizer3D.loadTextures(textureArchive); Rasterizer3D.setBrightness(0.80000000000000004D); @@ -8717,12 +8257,12 @@ void startUp() { Graphic.init(configArchive); VariablePlayer.init(configArchive); VariableBits.init(configArchive); - - ItemDefinition.init(null, null); - + + ItemDefinition.init(null, null); + ItemDefinition.isMembers = isMembers; drawLoadingText(95, "Unpacking interfaces"); - GameFont gameFonts[] = {smallText, regularText, boldText, gameFont}; + GameFont gameFonts[] = { smallText, regularText, boldText, gameFont }; Widget.load(interfaceArchive, gameFonts, mediaArchive); drawLoadingText(100, "Preparing game engine"); for (int j6 = 0; j6 < 33; j6++) { @@ -8746,8 +8286,7 @@ void startUp() { int j7 = 999; int l7 = 0; for (int j8 = 24; j8 < 177; j8++) { - if (mapBack.palettePixels[j8 + l6 * mapBack.width] == 0 - && (j8 > 34 || l6 > 34)) { + if (mapBack.palettePixels[j8 + l6 * mapBack.width] == 0 && (j8 > 34 || l6 > 34)) { if (j7 == 999) { j7 = j8; } @@ -8761,16 +8300,16 @@ void startUp() { } minimapLeft[l6 - 1] = j7 - 24; minimapLineWidth[l6 - 1] = l7 - j7; - } + } setBounds(); MessageCensor.load(wordencArchive); mouseDetection = new MouseDetection(this); startRunnable(mouseDetection, 10); SceneObject.clientInstance = this; ObjectDefinition.clientInstance = this; - NpcDefinition.clientInstance = this; - - //resourceProvider.writeAll(); + NpcDefinition.clientInstance = this; + + // resourceProvider.writeAll(); return; } catch (Exception exception) { exception.printStackTrace(); @@ -8781,7 +8320,7 @@ void startUp() { private void updatePlayerList(Buffer stream, int packetSize) { while (stream.bitPosition + 10 < packetSize * 8) { - int index = stream.readBits(11); + int index = stream.readBits(11); if (index == 2047) { break; } @@ -8821,8 +8360,7 @@ private void updatePlayerList(Buffer stream, int packetSize) { public boolean inCircle(int circleX, int circleY, int clickX, int clickY, int radius) { return java.lang.Math.pow((circleX + radius - clickX), 2) - + java.lang.Math.pow((circleY + radius - clickY), 2) < java.lang.Math - .pow(radius, 2); + + java.lang.Math.pow((circleY + radius - clickY), 2) < java.lang.Math.pow(radius, 2); } private void processMainScreenClick() { @@ -8846,58 +8384,53 @@ private void processMainScreenClick() { int i1 = Rasterizer3D.anIntArray1470[k]; int j1 = Rasterizer3D.COSINE[k]; i1 = i1 * (minimapZoom + 256) >> 8; - j1 = j1 * (minimapZoom + 256) >> 8; - int k1 = j * i1 + i * j1 >> 11; - int l1 = j * j1 - i * i1 >> 11; + j1 = j1 * (minimapZoom + 256) >> 8; + int k1 = j * i1 + i * j1 >> 11; + int l1 = j * j1 - i * i1 >> 11; int i2 = localPlayer.x + k1 >> 7; int j2 = localPlayer.y - l1 >> 7; - boolean flag1 = doWalkTo(1, 0, 0, 0, localPlayer.pathY[0], 0, 0, j2, - localPlayer.pathX[0], true, i2); + boolean flag1 = doWalkTo(1, 0, 0, 0, localPlayer.pathY[0], 0, 0, j2, localPlayer.pathX[0], true, i2); if (flag1) { - /*outgoing.writeByte(i); - outgoing.writeByte(j); - outgoing.writeShort(cameraHorizontal); - outgoing.writeByte(57); - outgoing.writeByte(minimapRotation); - outgoing.writeByte(minimapZoom); - outgoing.writeByte(89); - outgoing.writeShort(localPlayer.x); - outgoing.writeShort(localPlayer.y); - outgoing.writeByte(anInt1264); - outgoing.writeByte(63);*/ + /* + * outgoing.writeByte(i); outgoing.writeByte(j); + * outgoing.writeShort(cameraHorizontal); + * outgoing.writeByte(57); + * outgoing.writeByte(minimapRotation); + * outgoing.writeByte(minimapZoom); outgoing.writeByte(89); + * outgoing.writeShort(localPlayer.x); + * outgoing.writeShort(localPlayer.y); + * outgoing.writeByte(anInt1264); outgoing.writeByte(63); + */ } } anInt1117++; if (anInt1117 > 1151) { anInt1117 = 0; // anti-cheat - /*outgoing.writeOpcode(246); - outgoing.writeByte(0); - int bufPos = outgoing.currentPosition; - - if ((int) (Math.random() * 2D) == 0) { - outgoing.writeByte(101); - } - - outgoing.writeByte(197); - outgoing.writeShort((int) (Math.random() * 65536D)); - outgoing.writeByte((int) (Math.random() * 256D)); - outgoing.writeByte(67); - outgoing.writeShort(14214); - - if ((int) (Math.random() * 2D) == 0) { - outgoing.writeShort(29487); - } - - outgoing.writeShort((int) (Math.random() * 65536D)); - - if ((int) (Math.random() * 2D) == 0) { - outgoing.writeByte(220); - } - - outgoing.writeByte(180); - outgoing.writeBytes(outgoing.currentPosition - bufPos);*/ + /* + * outgoing.writeOpcode(246); outgoing.writeByte(0); int bufPos + * = outgoing.currentPosition; + * + * if ((int) (Math.random() * 2D) == 0) { + * outgoing.writeByte(101); } + * + * outgoing.writeByte(197); outgoing.writeShort((int) + * (Math.random() * 65536D)); outgoing.writeByte((int) + * (Math.random() * 256D)); outgoing.writeByte(67); + * outgoing.writeShort(14214); + * + * if ((int) (Math.random() * 2D) == 0) { + * outgoing.writeShort(29487); } + * + * outgoing.writeShort((int) (Math.random() * 65536D)); + * + * if ((int) (Math.random() * 2D) == 0) { + * outgoing.writeByte(220); } + * + * outgoing.writeByte(180); + * outgoing.writeBytes(outgoing.currentPosition - bufPos); + */ } } } @@ -8919,8 +8452,7 @@ private void showErrorScreen() { g.setFont(new Font("Helvetica", 1, 16)); g.setColor(Color.yellow); int k = 35; - g.drawString("Sorry, an error has occured whilst loading " - + Configuration.CLIENT_NAME, 30, k); + g.drawString("Sorry, an error has occured whilst loading " + Configuration.CLIENT_NAME, 30, k); k += 50; g.setColor(Color.white); g.drawString("To fix this try the following (in order):", 30, k); @@ -8929,33 +8461,27 @@ private void showErrorScreen() { g.setFont(new Font("Helvetica", 1, 12)); g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, k); k += 30; - g.drawString( - "2: Try clearing your web-browsers cache from tools->internet options", - 30, k); + g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, k); k += 30; g.drawString("3: Try using a different game-world", 30, k); k += 30; g.drawString("4: Try rebooting your computer", 30, k); k += 30; - g.drawString( - "5: Try selecting a different version of Java from the play-game menu", - 30, k); + g.drawString("5: Try selecting a different version of Java from the play-game menu", 30, k); } if (genericLoadingError) { aBoolean831 = false; g.setFont(new Font("Helvetica", 1, 20)); g.setColor(Color.white); g.drawString("Error - unable to load game!", 50, 50); - g.drawString("To play " + Configuration.CLIENT_NAME + " make sure you play from", - 50, 100); + g.drawString("To play " + Configuration.CLIENT_NAME + " make sure you play from", 50, 100); g.drawString("http://www.UrlHere.com", 50, 150); } if (rsAlreadyLoaded) { aBoolean831 = false; g.setColor(Color.yellow); int l = 35; - g.drawString("Error a copy of " + Configuration.CLIENT_NAME - + " already appears to be loaded", 30, l); + g.drawString("Error a copy of " + Configuration.CLIENT_NAME + " already appears to be loaded", 30, l); l += 50; g.setColor(Color.white); g.drawString("To fix this try the following (in order):", 30, l); @@ -8969,6 +8495,7 @@ private void showErrorScreen() { } } + @Override public URL getCodeBase() { try { return new URL(server + ":" + (80 + portOffset)); @@ -8986,7 +8513,7 @@ private void processNpcMovement() { } } - private void processMovement(Mob mob) { + private void processMovement(Mob mob) { if (mob.x < 128 || mob.y < 128 || mob.x >= 13184 || mob.y >= 13184) { mob.emoteAnimation = -1; mob.graphic = -1; @@ -8996,8 +8523,7 @@ private void processMovement(Mob mob) { mob.y = mob.pathY[0] * 128 + mob.size * 64; mob.resetPath(); } - if (mob == localPlayer && (mob.x < 1536 || mob.y < 1536 || mob.x >= 11776 - || mob.y >= 11776)) { + if (mob == localPlayer && (mob.x < 1536 || mob.y < 1536 || mob.x >= 11776 || mob.y >= 11776)) { mob.emoteAnimation = -1; mob.graphic = -1; mob.startForceMovement = 0; @@ -9007,27 +8533,27 @@ private void processMovement(Mob mob) { mob.resetPath(); } if (mob.startForceMovement > tick) { - mob.nextPreForcedStep(); + mob.nextPreForcedStep(); } else if (mob.endForceMovement >= tick) { - mob.nextForcedMovementStep(); + mob.nextForcedMovementStep(); } else { - mob.nextStep(); + mob.nextStep(); } appendFocusDestination(mob); - mob.updateAnimation(); + mob.updateAnimation(); } private void appendFocusDestination(Mob entity) { if (entity.degreesToTurn == 0) return; - if (entity.interactingEntity != -1 && entity.interactingEntity < 32768 && entity.interactingEntity < npcs.length) { + if (entity.interactingEntity != -1 && entity.interactingEntity < 32768 + && entity.interactingEntity < npcs.length) { Npc npc = npcs[entity.interactingEntity]; if (npc != null) { int i1 = entity.x - npc.x; int k1 = entity.y - npc.y; if (i1 != 0 || k1 != 0) - entity.nextStepOrientation = - (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff; + entity.nextStepOrientation = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff; } } if (entity.interactingEntity >= 32768) { @@ -9040,8 +8566,7 @@ private void appendFocusDestination(Mob entity) { int l1 = entity.x - player.x; int i2 = entity.y - player.y; if (l1 != 0 || i2 != 0) { - entity.nextStepOrientation = - (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff; + entity.nextStepOrientation = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff; } } } @@ -9049,8 +8574,7 @@ private void appendFocusDestination(Mob entity) { int k = entity.x - (entity.faceX - regionBaseX - regionBaseX) * 64; int j1 = entity.y - (entity.faceY - regionBaseY - regionBaseY) * 64; if (k != 0 || j1 != 0) - entity.nextStepOrientation = - (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff; + entity.nextStepOrientation = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff; entity.faceX = 0; entity.faceY = 0; } @@ -9063,8 +8587,7 @@ else if (l > 1024) else entity.orientation += entity.degreesToTurn; entity.orientation &= 0x7ff; - if (entity.movementAnimation == entity.idleAnimation - && entity.orientation != entity.nextStepOrientation) { + if (entity.movementAnimation == entity.idleAnimation && entity.orientation != entity.nextStepOrientation) { if (entity.standTurnAnimIndex != -1) { entity.movementAnimation = entity.standTurnAnimIndex; return; @@ -9074,18 +8597,15 @@ else if (l > 1024) } } - - private void drawGameScreen() { - if (fullscreenInterfaceID != -1 - && (loadingStage == 2 || super.fullGameScreen != null)) { + if (fullscreenInterfaceID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) { if (loadingStage == 2) { try { processWidgetAnimations(tickDelta, fullscreenInterfaceID); if (openInterfaceId != -1) { processWidgetAnimations(tickDelta, openInterfaceId); } - } catch(Exception ex) { + } catch (Exception ex) { } tickDelta = 0; @@ -9096,20 +8616,18 @@ private void drawGameScreen() { welcomeScreenRaised = true; if (openInterfaceId != -1) { Widget rsInterface_1 = Widget.interfaceCache[openInterfaceId]; - if (rsInterface_1.width == 512 && rsInterface_1.height == 334 - && rsInterface_1.type == 0) { + if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) { rsInterface_1.width = 765; rsInterface_1.height = 503; } try { drawInterface(0, 0, rsInterface_1, 8); - } catch(Exception ex) { + } catch (Exception ex) { } } Widget rsInterface = Widget.interfaceCache[fullscreenInterfaceID]; - if (rsInterface.width == 512 && rsInterface.height == 334 - && rsInterface.type == 0) { + if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) { rsInterface.width = 765; rsInterface.height = 503; } @@ -9122,8 +8640,7 @@ private void drawGameScreen() { processRightClick(); drawTooltip(); } else { - drawMenu(frameMode == ScreenMode.FIXED ? 4 : 0, - frameMode == ScreenMode.FIXED ? 4 : 0); + drawMenu(frameMode == ScreenMode.FIXED ? 4 : 0, frameMode == ScreenMode.FIXED ? 4 : 0); } } drawCount++; @@ -9144,9 +8661,8 @@ private void drawGameScreen() { tabAreaAltered = true; if (loadingStage != 2) { if (frameMode == ScreenMode.FIXED) { - gameScreenImageProducer.drawGraphics( - frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, - frameMode == ScreenMode.FIXED ? 4 : 0); + gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, + frameMode == ScreenMode.FIXED ? 4 : 0); minimapImageProducer.drawGraphics(0, super.graphics, 516); } } @@ -9162,12 +8678,10 @@ private void drawGameScreen() { if (backDialogueId == -1) { aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 110; if (super.mouseX >= 496 && super.mouseX <= 511 - && super.mouseY > (frameMode == ScreenMode.FIXED ? 345 - : frameHeight - 158)) + && super.mouseY > (frameMode == ScreenMode.FIXED ? 345 : frameHeight - 158)) method65(494, 110, super.mouseX, - super.mouseY - (frameMode == ScreenMode.FIXED ? 345 - : frameHeight - 158), - aClass9_1059, 0, false, anInt1211); + super.mouseY - (frameMode == ScreenMode.FIXED ? 345 : frameHeight - 158), aClass9_1059, 0, + false, anInt1211); int i = anInt1211 - 110 - aClass9_1059.scrollPosition; if (i < 0) { i = 0; @@ -9185,7 +8699,7 @@ private void drawGameScreen() { try { flag2 = processWidgetAnimations(tickDelta, backDialogueId); - } catch(Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); } @@ -9219,8 +8733,9 @@ private void drawGameScreen() { if (flashingSidebarId != -1 && flashingSidebarId == tabId) { flashingSidebarId = -1; // flashing sidebar - /*outgoing.writeOpcode(120); - outgoing.writeByte(tabId);*/ + /* + * outgoing.writeOpcode(120); outgoing.writeByte(tabId); + */ } tabAreaAltered = false; chatSettingImageProducer.initDrawingArea(); @@ -9259,23 +8774,19 @@ else if (i >= 101) } private void createStationaryGraphics() { - AnimableObject class30_sub2_sub4_sub3 = - (AnimableObject) incompleteAnimables.reverseGetFirst(); - for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = - (AnimableObject) incompleteAnimables.reverseGetNext()) - if (class30_sub2_sub4_sub3.anInt1560 != plane - || class30_sub2_sub4_sub3.aBoolean1567) + AnimableObject class30_sub2_sub4_sub3 = (AnimableObject) incompleteAnimables.reverseGetFirst(); + for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (AnimableObject) incompleteAnimables + .reverseGetNext()) + if (class30_sub2_sub4_sub3.anInt1560 != plane || class30_sub2_sub4_sub3.aBoolean1567) class30_sub2_sub4_sub3.unlink(); else if (tick >= class30_sub2_sub4_sub3.anInt1564) { class30_sub2_sub4_sub3.method454(tickDelta); if (class30_sub2_sub4_sub3.aBoolean1567) class30_sub2_sub4_sub3.unlink(); else - scene.addAnimableA(class30_sub2_sub4_sub3.anInt1560, 0, - class30_sub2_sub4_sub3.anInt1563, -1, - class30_sub2_sub4_sub3.anInt1562, 60, - class30_sub2_sub4_sub3.anInt1561, class30_sub2_sub4_sub3, - false); + scene.addAnimableA(class30_sub2_sub4_sub3.anInt1560, 0, class30_sub2_sub4_sub3.anInt1563, -1, + class30_sub2_sub4_sub3.anInt1562, 60, class30_sub2_sub4_sub3.anInt1561, + class30_sub2_sub4_sub3, false); } } @@ -9290,34 +8801,26 @@ public void drawBlackBox(int xPos, int yPos) { Rasterizer2D.drawBox(xPos, yPos - 1, 175, 1, 0x2E2B23); Rasterizer2D.drawBox(xPos, yPos + 69, 175, 1, 0x2E2B23); Rasterizer2D.drawTransparentBox(xPos, yPos, 174, 68, 0, 220); - } - - final static int[] IDs = {1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, - 1283, 1573, 1290, 1299, 1308, 1315, 1324, 1333, 1340, 1349, 1358, - 1367, 1374, 1381, 1388, 1397, 1404, 1583, 12038, 1414, 1421, 1430, - 1437, 1446, 1453, 1460, 1469, 15878, 1602, 1613, 1624, 7456, 1478, - 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553, 1563, 1593, 1635, - 12426, 12436, 12446, 12456, 6004, 18471, + } + + final static int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573, 1290, 1299, + 1308, 1315, 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397, 1404, 1583, 12038, 1414, 1421, 1430, + 1437, 1446, 1453, 1460, 1469, 15878, 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, + 1553, 1563, 1593, 1635, 12426, 12436, 12446, 12456, 6004, 18471, /* Ancients */ - 12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, - 12882, 13062, 12952, 13000, 13070, 12912, 12872, 13080, 12976, 13024, - 13088, 12930, 12892, 13096}; - - final static int[] runeChildren = {1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, - 1234, 1235, 1236, 1243, 1244, 1245, 1252, 1253, 1254, 1261, 1262, - 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, 1295, - 1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, - 1336, 1337, 1343, 1344, 1345, 1352, 1353, 1354, 1361, 1362, 1363, - 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400, 1401, - 1407, 1408, 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, - 1441, 1442, 1449, 1450, 1456, 1457, 1463, 1464, 1465, 1472, 1473, - 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499, 1506, 1507, - 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534, 1535, 1547, - 1548, 1549, 1556, 1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, - 1586, 1587, 1588, 1596, 1597, 1598, 1605, 1606, 1607, 1616, 1617, - 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011, 8673, - 8674, 12041, 12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, - 12450, 12451, 12459, 12460, 15881, 15882, 15885, 18474, 18475, 18478}; + 12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062, 12952, 13000, 13070, + 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096 }; + + final static int[] runeChildren = { 1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, + 1243, 1244, 1245, 1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, + 1295, 1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345, 1352, + 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400, 1401, 1407, 1408, + 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450, 1456, 1457, 1463, 1464, 1465, + 1472, 1473, 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499, 1506, 1507, 1508, 1515, 1516, 1517, 1524, + 1525, 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556, 1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, 1586, + 1587, 1588, 1596, 1597, 1598, 1605, 1606, 1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, + 6008, 6011, 8673, 8674, 12041, 12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, + 12460, 15881, 15882, 15885, 18474, 18475, 18478 }; private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throws Exception { if (rsInterface == null) @@ -9328,7 +8831,7 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw && anInt1039 != rsInterface.id || rsInterface.drawingDisabled) { return; } - + int clipLeft = Rasterizer2D.leftX; int clipTop = Rasterizer2D.topY; int clipRight = Rasterizer2D.bottomX; @@ -9340,14 +8843,14 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw int _x = rsInterface.childX[childId] + x; int currentY = (rsInterface.childY[childId] + y) - scroll_y; Widget childInterface = Widget.interfaceCache[rsInterface.children[childId]]; - if(childInterface == null) { + if (childInterface == null) { continue; } - - if(childInterface.drawingDisabled) { + + if (childInterface.drawingDisabled) { continue; } - + _x += childInterface.horizontalOffset; currentY += childInterface.verticalOffset; if (childInterface.contentType > 0) @@ -9365,17 +8868,14 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw childInterface.modelZoom = 775; if (childInterface.type == Widget.TYPE_CONTAINER) { - if (childInterface.scrollPosition > childInterface.scrollMax - - childInterface.height) - childInterface.scrollPosition = - childInterface.scrollMax - childInterface.height; + if (childInterface.scrollPosition > childInterface.scrollMax - childInterface.height) + childInterface.scrollPosition = childInterface.scrollMax - childInterface.height; if (childInterface.scrollPosition < 0) childInterface.scrollPosition = 0; drawInterface(childInterface.scrollPosition, _x, childInterface, currentY); if (childInterface.scrollMax > childInterface.height) { - drawScrollbar(childInterface.height, childInterface.scrollPosition, - currentY, _x + childInterface.width, childInterface.scrollMax, - false); + drawScrollbar(childInterface.height, childInterface.scrollPosition, currentY, + _x + childInterface.width, childInterface.scrollMax, false); } } else if (childInterface.type != 1) if (childInterface.type == Widget.TYPE_INVENTORY) { @@ -9383,57 +8883,42 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw int item = 0; for (int row = 0; row < childInterface.height; row++) { for (int column = 0; column < childInterface.width; column++) { - int tileX = _x + column - * (32 + childInterface.spritePaddingX); - int tileY = currentY - + row * (32 + childInterface.spritePaddingY); + int tileX = _x + column * (32 + childInterface.spritePaddingX); + int tileY = currentY + row * (32 + childInterface.spritePaddingY); if (item < 20) { tileX += childInterface.spritesX[item]; tileY += childInterface.spritesY[item]; } - if (item < childInterface.inventoryItemId.length && childInterface.inventoryItemId[item] > 0) { + if (item < childInterface.inventoryItemId.length + && childInterface.inventoryItemId[item] > 0) { int differenceX = 0; int differenceY = 0; - int itemId = childInterface.inventoryItemId[item] - - 1; - if (tileX > Rasterizer2D.leftX - 32 - && tileX < Rasterizer2D.bottomX - && tileY > Rasterizer2D.topY - 32 - && tileY < Rasterizer2D.bottomY - || activeInterfaceType != 0 - && anInt1085 == item) { + int itemId = childInterface.inventoryItemId[item] - 1; + if (tileX > Rasterizer2D.leftX - 32 && tileX < Rasterizer2D.bottomX + && tileY > Rasterizer2D.topY - 32 && tileY < Rasterizer2D.bottomY + || activeInterfaceType != 0 && anInt1085 == item) { int l9 = 0; - if (itemSelected == 1 && anInt1283 == item - && anInt1284 == childInterface.id) + if (itemSelected == 1 && anInt1283 == item && anInt1284 == childInterface.id) l9 = 0xffffff; - Sprite item_icon = - ItemDefinition.getSprite(itemId, - childInterface.inventoryAmounts[item], - l9); + Sprite item_icon = ItemDefinition.getSprite(itemId, + childInterface.inventoryAmounts[item], l9); if (item_icon != null) { - if (activeInterfaceType != 0 - && anInt1085 == item + if (activeInterfaceType != 0 && anInt1085 == item && anInt1084 == childInterface.id) { - differenceX = super.mouseX - - anInt1087; - differenceY = super.mouseY - - anInt1088; - if (differenceX < 5 - && differenceX > -5) + differenceX = super.mouseX - anInt1087; + differenceY = super.mouseY - anInt1088; + if (differenceX < 5 && differenceX > -5) differenceX = 0; - if (differenceY < 5 - && differenceY > -5) + if (differenceY < 5 && differenceY > -5) differenceY = 0; if (anInt989 < 10) { differenceX = 0; differenceY = 0; } - item_icon.drawSprite1( - tileX + differenceX, - tileY + differenceY); + item_icon.drawSprite1(tileX + differenceX, tileY + differenceY); int yy = frameMode == ScreenMode.FIXED ? 40 : 40 + (frameHeight / 2) - 167; - if(openInterfaceId == 5292) { - if(super.mouseY >= yy && super.mouseY <= yy+37) { + if (openInterfaceId == 5292) { + if (super.mouseY >= yy && super.mouseY <= yy + 37) { bankItemDragSprite = item_icon; bankItemDragSpriteX = super.mouseX; bankItemDragSpriteY = super.mouseY; @@ -9443,80 +8928,56 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw } if (tileY + differenceY < Rasterizer2D.topY && rsInterface.scrollPosition > 0) { - int i10 = (tickDelta - * (Rasterizer2D.topY - - tileY - - differenceY)) - / 3; + int i10 = (tickDelta * (Rasterizer2D.topY - tileY - differenceY)) / 3; if (i10 > tickDelta * 10) i10 = tickDelta * 10; if (i10 > rsInterface.scrollPosition) i10 = rsInterface.scrollPosition; - rsInterface.scrollPosition -= - i10; + rsInterface.scrollPosition -= i10; anInt1088 += i10; } - if (tileY + differenceY - + 32 > Rasterizer2D.bottomY + if (tileY + differenceY + 32 > Rasterizer2D.bottomY && rsInterface.scrollPosition < rsInterface.scrollMax - - rsInterface.height) { + - rsInterface.height) { int j10 = (tickDelta - * ((tileY + differenceY - + 32) - - Rasterizer2D.bottomY)) - / 3; + * ((tileY + differenceY + 32) - Rasterizer2D.bottomY)) / 3; if (j10 > tickDelta * 10) j10 = tickDelta * 10; - if (j10 > rsInterface.scrollMax - - rsInterface.height + if (j10 > rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition) - j10 = rsInterface.scrollMax - - rsInterface.height - - rsInterface.scrollPosition; - rsInterface.scrollPosition += - j10; + j10 = rsInterface.scrollMax - rsInterface.height + - rsInterface.scrollPosition; + rsInterface.scrollPosition += j10; anInt1088 -= j10; } - } else if (atInventoryInterfaceType != 0 - && atInventoryIndex == item + } else if (atInventoryInterfaceType != 0 && atInventoryIndex == item && atInventoryInterface == childInterface.id) - item_icon.drawSprite1(tileX, - tileY); + item_icon.drawSprite1(tileX, tileY); else - item_icon.drawSprite(tileX, - tileY); - if (item_icon.maxWidth == 33 - || childInterface.inventoryAmounts[item] != 1) { + item_icon.drawSprite(tileX, tileY); + if (item_icon.maxWidth == 33 || childInterface.inventoryAmounts[item] != 1) { boolean flag = true; - if(childInterface.id >= 22035 && childInterface.id <= 22043) { + if (childInterface.id >= 22035 && childInterface.id <= 22043) { flag = false; } - if(flag) { + if (flag) { int k10 = childInterface.inventoryAmounts[item]; - if(k10 >= 1500000000 && childInterface.drawInfinity) { + if (k10 >= 1500000000 && childInterface.drawInfinity) { cacheSprite[105].drawSprite(tileX, tileY); } else { - smallText.render(0, - intToKOrMil(k10), - tileY + 10 + differenceY, + smallText.render(0, intToKOrMil(k10), tileY + 10 + differenceY, tileX + 1 + differenceX); if (k10 >= 1) - smallText.render(0xFFFF00, - intToKOrMil(k10), - tileY + 9 + differenceY, - tileX + differenceX); + smallText.render(0xFFFF00, intToKOrMil(k10), + tileY + 9 + differenceY, tileX + differenceX); if (k10 >= 100000) - smallText.render(0xFFFFFF, - intToKOrMil(k10), - tileY + 9 + differenceY, - tileX + differenceX); + smallText.render(0xFFFFFF, intToKOrMil(k10), + tileY + 9 + differenceY, tileX + differenceX); if (k10 >= 10000000) - smallText.render(0x00FF80, - intToKOrMil(k10), - tileY + 9 + differenceY, - tileX + differenceX); + smallText.render(0x00FF80, intToKOrMil(k10), + tileY + 9 + differenceY, tileX + differenceX); } } } @@ -9548,23 +9009,20 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw } if (childInterface.opacity == 0) { if (childInterface.filled) - Rasterizer2D.drawBox(_x, currentY, childInterface.width, childInterface.height, colour - ); + Rasterizer2D.drawBox(_x, currentY, childInterface.width, childInterface.height, colour); else - Rasterizer2D.drawBoxOutline(_x, currentY, childInterface.width, - childInterface.height, colour); + Rasterizer2D.drawBoxOutline(_x, currentY, childInterface.width, childInterface.height, + colour); } else if (childInterface.filled) - Rasterizer2D.drawTransparentBox(_x, currentY, childInterface.width, childInterface.height, colour, - 256 - (childInterface.opacity & 0xff)); + Rasterizer2D.drawTransparentBox(_x, currentY, childInterface.width, childInterface.height, + colour, 256 - (childInterface.opacity & 0xff)); else - Rasterizer2D.drawTransparentBoxOutline(_x, currentY, childInterface.width, childInterface.height, - colour, 256 - (childInterface.opacity & 0xff) - ); + Rasterizer2D.drawTransparentBoxOutline(_x, currentY, childInterface.width, + childInterface.height, colour, 256 - (childInterface.opacity & 0xff)); } else if (childInterface.type == Widget.TYPE_TEXT) { GameFont textDrawingArea = childInterface.textDrawingAreas; String text = childInterface.defaultText; - boolean flag1 = false; if (anInt1039 == childInterface.id || anInt1048 == childInterface.id || anInt1026 == childInterface.id) @@ -9581,8 +9039,7 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw if (flag1 && childInterface.defaultHoverColor != 0) colour = childInterface.defaultHoverColor; } - if (childInterface.atActionType == Widget.OPTION_CONTINUE - && continuedDialogue) { + if (childInterface.atActionType == Widget.OPTION_CONTINUE && continuedDialogue) { text = "Please wait..."; colour = childInterface.textColor; } @@ -9594,10 +9051,8 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw } if (frameMode != ScreenMode.FIXED) { if ((backDialogueId != -1 || dialogueId != -1 - || childInterface.defaultText - .contains("Click here to continue")) - && (rsInterface.id == backDialogueId - || rsInterface.id == dialogueId)) { + || childInterface.defaultText.contains("Click here to continue")) + && (rsInterface.id == backDialogueId || rsInterface.id == dialogueId)) { if (colour == 0xffff00) { colour = 255; } @@ -9606,16 +9061,15 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw } } } - if ((childInterface.parent == 1151) - || (childInterface.parent == 12855)) { + if ((childInterface.parent == 1151) || (childInterface.parent == 12855)) { switch (colour) { case 16773120: colour = 0xFE981F; break; case 7040819: colour = 0xAF6A1A; - break; - } + break; + } } int image = -1; @@ -9627,26 +9081,28 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw image = Integer.parseInt(text.substring(prefix + 5, suffix)); text = text.replaceAll(text.substring(prefix + 5, suffix), ""); text = text.replaceAll("", ""); - text = text.replaceAll("", ""); - } catch (NumberFormatException nfe) { - //System.out.println("Unable to draw player crown on interface. Unable to read rights."); + text = text.replaceAll("", ""); + } catch (NumberFormatException nfe) { + // System.out.println("Unable to draw player crown + // on interface. Unable to read rights."); text = INITIAL_MESSAGE; } catch (IllegalStateException ise) { - //System.out.println("Unable to draw player crown on interface, rights too low or high."); + // System.out.println("Unable to draw player crown + // on interface, rights too low or high."); text = INITIAL_MESSAGE; } - if(suffix > prefix) { - //_x += 14; + if (suffix > prefix) { + // _x += 14; } } - for (int drawY = currentY + textDrawingArea.verticalSpace; text.length() > 0; drawY += - textDrawingArea.verticalSpace) { + for (int drawY = currentY + textDrawingArea.verticalSpace; text + .length() > 0; drawY += textDrawingArea.verticalSpace) { - if(image != -1) { + if (image != -1) { - //CLAN CHAT LIST = 37128 - if(childInterface.parent == 37128) { + // CLAN CHAT LIST = 37128 + if (childInterface.parent == 37128) { cacheSprite[image].drawAdvancedSprite(_x, drawY - cacheSprite[image].myHeight - 1); _x += cacheSprite[image].myWidth + 3; } else { @@ -9655,35 +9111,30 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw } } - if (text.indexOf("%") != -1) { + if (text.indexOf("%") != -1) { do { int index = text.indexOf("%1"); if (index == -1) break; - if (childInterface.id < 4000 || childInterface.id > 5000 - && childInterface.id != 13921 - && childInterface.id != 13922 - && childInterface.id != 12171 + if (childInterface.id < 4000 || childInterface.id > 5000 && childInterface.id != 13921 + && childInterface.id != 13922 && childInterface.id != 12171 && childInterface.id != 12172) { - text = text.substring(0, index) - + formatCoins(executeScript( - childInterface, 0)) + text = text.substring(0, index) + formatCoins(executeScript(childInterface, 0)) + text.substring(index + 2); } else { - text = text.substring(0, index) + interfaceIntToString(executeScript(childInterface, 0)) - + text.substring(index + 2); + text = text.substring(0, index) + + interfaceIntToString(executeScript(childInterface, 0)) + + text.substring(index + 2); } } while (true); do { - int index = text.indexOf("%2"); + int index = text.indexOf("%2"); if (index == -1) { break; } - text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 1)) + text = text.substring(0, index) + interfaceIntToString(executeScript(childInterface, 1)) + text.substring(index + 2); } while (true); do { @@ -9693,20 +9144,16 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw break; } - text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 2)) + text = text.substring(0, index) + interfaceIntToString(executeScript(childInterface, 2)) + text.substring(index + 2); } while (true); do { - int index = text.indexOf("%4"); + int index = text.indexOf("%4"); if (index == -1) { break; } - text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 3)) + text = text.substring(0, index) + interfaceIntToString(executeScript(childInterface, 3)) + text.substring(index + 2); } while (true); do { @@ -9716,9 +9163,7 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw break; } - text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 4)) + text = text.substring(0, index) + interfaceIntToString(executeScript(childInterface, 4)) + text.substring(index + 2); } while (true); } @@ -9745,23 +9190,21 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw font = newFancyFont; } if (childInterface.centerText) { - font.drawCenteredString(drawn, _x + childInterface.width / 2, - drawY, colour, + font.drawCenteredString(drawn, _x + childInterface.width / 2, drawY, colour, childInterface.textShadow ? 0 : -1); } else { - font.drawBasicString(drawn, _x, drawY, colour, - childInterface.textShadow ? 0 : -1); + font.drawBasicString(drawn, _x, drawY, colour, childInterface.textShadow ? 0 : -1); } } } else if (childInterface.type == Widget.TYPE_SPRITE) { Sprite sprite; - if(childInterface.spriteXOffset != 0) { + if (childInterface.spriteXOffset != 0) { _x += childInterface.spriteXOffset; } - if(childInterface.spriteYOffset != 0) { + if (childInterface.spriteYOffset != 0) { currentY += childInterface.spriteYOffset; } @@ -9771,18 +9214,16 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw sprite = childInterface.disabledSprite; } - - if (spellSelected == 1 && childInterface.id == spellId && spellId != 0 - && sprite != null) { + if (spellSelected == 1 && childInterface.id == spellId && spellId != 0 && sprite != null) { sprite.drawSprite(_x, currentY, 0xffffff); } else { if (sprite != null) { boolean drawTransparent = childInterface.drawsTransparent; - //Check if parent draws as transparent.. - if(!drawTransparent && childInterface.parent > 0 && - Widget.interfaceCache[childInterface.parent] != null) { + // Check if parent draws as transparent.. + if (!drawTransparent && childInterface.parent > 0 + && Widget.interfaceCache[childInterface.parent] != null) { drawTransparent = Widget.interfaceCache[childInterface.parent].drawsTransparent; } @@ -9802,111 +9243,93 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw Rasterizer3D.originViewY = currentY + childInterface.height / 2; int sine = Rasterizer3D.anIntArray1470[childInterface.modelRotation1] * childInterface.modelZoom >> 16; - int cosine = Rasterizer3D.COSINE[childInterface.modelRotation1] - * childInterface.modelZoom >> 16; - boolean selected = interfaceIsSelected(childInterface); - int emoteAnimation; - if (selected) - emoteAnimation = childInterface.secondaryAnimationId; - else - emoteAnimation = childInterface.defaultAnimationId; - Model model; - if (emoteAnimation == -1) { - model = childInterface.method209(-1, -1, selected); - } else { - Animation animation = Animation.animations[emoteAnimation]; - model = childInterface.method209( - animation.secondaryFrames[childInterface.currentFrame], - animation.primaryFrames[childInterface.currentFrame], - selected); - } - if (model != null) - model.method482(childInterface.modelRotation2, 0, - childInterface.modelRotation1, 0, sine, cosine); - Rasterizer3D.originViewX = centreX; - Rasterizer3D.originViewY = centreY; + int cosine = Rasterizer3D.COSINE[childInterface.modelRotation1] * childInterface.modelZoom >> 16; + boolean selected = interfaceIsSelected(childInterface); + int emoteAnimation; + if (selected) + emoteAnimation = childInterface.secondaryAnimationId; + else + emoteAnimation = childInterface.defaultAnimationId; + Model model; + if (emoteAnimation == -1) { + model = childInterface.method209(-1, -1, selected); + } else { + Animation animation = Animation.animations[emoteAnimation]; + model = childInterface.method209(animation.secondaryFrames[childInterface.currentFrame], + animation.primaryFrames[childInterface.currentFrame], selected); + } + if (model != null) + model.method482(childInterface.modelRotation2, 0, childInterface.modelRotation1, 0, sine, + cosine); + Rasterizer3D.originViewX = centreX; + Rasterizer3D.originViewY = centreY; } else if (childInterface.type == Widget.TYPE_ITEM_LIST) { GameFont font = childInterface.textDrawingAreas; int slot = 0; for (int row = 0; row < childInterface.height; row++) { for (int column = 0; column < childInterface.width; column++) { if (childInterface.inventoryItemId[slot] > 0) { - ItemDefinition item = ItemDefinition - .lookup(childInterface.inventoryItemId[slot] - - 1); + ItemDefinition item = ItemDefinition.lookup(childInterface.inventoryItemId[slot] - 1); String name = item.name; - if (item.stackable - || childInterface.inventoryAmounts[slot] != 1) - name = name + " x" + intToKOrMilLongName( - childInterface.inventoryAmounts[slot]); - int __x = _x + column - * (115 + childInterface.spritePaddingX); - int __y = currentY + row - * (12 + childInterface.spritePaddingY); + if (item.stackable || childInterface.inventoryAmounts[slot] != 1) + name = name + " x" + intToKOrMilLongName(childInterface.inventoryAmounts[slot]); + int __x = _x + column * (115 + childInterface.spritePaddingX); + int __y = currentY + row * (12 + childInterface.spritePaddingY); if (childInterface.centerText) - font.method382(childInterface.textColor, - __x + childInterface.width / 2, - name, __y, + font.method382(childInterface.textColor, __x + childInterface.width / 2, name, __y, childInterface.textShadow); else - font.drawTextWithPotentialShadow( - childInterface.textShadow, __x, - childInterface.textColor, name, - __y); + font.drawTextWithPotentialShadow(childInterface.textShadow, __x, + childInterface.textColor, name, __y); } slot++; } - } - } else if (childInterface.type == 8 - && (anInt1500 == childInterface.id - || anInt1044 == childInterface.id - || anInt1129 == childInterface.id) - && anInt1501 == 0 && !menuOpen) { + } + } else if (childInterface.type == 8 && (anInt1500 == childInterface.id || anInt1044 == childInterface.id + || anInt1129 == childInterface.id) && anInt1501 == 0 && !menuOpen) { /** - * Skill tab hovers - * Remove "next level at" and "remaining" + * Skill tab hovers Remove "next level at" and "remaining" * for xp if we're level 99. */ - if(childInterface.parent == 3917) { - if(childInterface.id != 24154) { //Not total level + if (childInterface.parent == 3917) { + if (childInterface.id != 24154) { // Not total level int maxLevel = executeScript(childInterface, 1); int next = childInterface.defaultText.indexOf("Next"); - if(maxLevel >= 99) { - if(next != -1) { + if (maxLevel >= 99) { + if (next != -1) { childInterface.defaultText = childInterface.defaultText.substring(0, next); } } else { - if(next == -1) { + if (next == -1) { childInterface.defaultText += "Next level: %4\\nRemainder: %5"; } - //Hover fix - if(currentY > 200) { + // Hover fix + if (currentY > 200) { currentY -= 100; } } } - //Hover fix - if(_x > 100) { + // Hover fix + if (_x > 100) { _x = 100; } - if(currentY > 200) { + if (currentY > 200) { currentY -= 80; } } - if(childInterface.hoverXOffset != 0) { + if (childInterface.hoverXOffset != 0) { _x += childInterface.hoverXOffset; } - if(childInterface.hoverYOffset != 0) { + if (childInterface.hoverYOffset != 0) { currentY += childInterface.hoverYOffset; } - - if(childInterface.regularHoverBox) { + if (childInterface.regularHoverBox) { drawHoverBox(_x, currentY, childInterface.defaultText); } else { @@ -9920,8 +9343,7 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw if (index == -1) break; text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 0)) + + interfaceIntToString(executeScript(childInterface, 0)) + text.substring(index + 2); } while (true); do { @@ -9929,8 +9351,7 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw if (index == -1) break; text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 1)) + + interfaceIntToString(executeScript(childInterface, 1)) + text.substring(index + 2); } while (true); do { @@ -9938,8 +9359,7 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw if (index == -1) break; text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 2)) + + interfaceIntToString(executeScript(childInterface, 2)) + text.substring(index + 2); } while (true); do { @@ -9947,8 +9367,7 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw if (index == -1) break; text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 3)) + + interfaceIntToString(executeScript(childInterface, 3)) + text.substring(index + 2); } while (true); do { @@ -9956,8 +9375,7 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw if (index == -1) break; text = text.substring(0, index) - + interfaceIntToString(executeScript( - childInterface, 4)) + + interfaceIntToString(executeScript(childInterface, 4)) + text.substring(index + 2); } while (true); } @@ -9997,19 +9415,16 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw Rasterizer2D.drawBox(xPos, yPos, boxWidth, boxHeight, 0xFFFFA0); Rasterizer2D.drawBoxOutline(xPos, yPos, boxWidth, boxHeight, 0); - //Script hovers here + // Script hovers here - for (int j11 = yPos + font.verticalSpace + 2; s2.length() > 0; j11 += - font.verticalSpace + 1) {// verticalSpace + for (int j11 = yPos + font.verticalSpace + 2; s2.length() > 0; j11 += font.verticalSpace + 1) {// verticalSpace if (s2.indexOf("%") != -1) { do { int k7 = s2.indexOf("%1"); if (k7 == -1) break; - s2 = s2.substring(0, k7) - + interfaceIntToString(executeScript( - childInterface, 0)) + s2 = s2.substring(0, k7) + interfaceIntToString(executeScript(childInterface, 0)) + s2.substring(k7 + 2); } while (true); @@ -10017,36 +9432,28 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw int l7 = s2.indexOf("%2"); if (l7 == -1) break; - s2 = s2.substring(0, l7) - + interfaceIntToString(executeScript( - childInterface, 1)) + s2 = s2.substring(0, l7) + interfaceIntToString(executeScript(childInterface, 1)) + s2.substring(l7 + 2); } while (true); do { int i8 = s2.indexOf("%3"); if (i8 == -1) break; - s2 = s2.substring(0, i8) - + interfaceIntToString(executeScript( - childInterface, 2)) + s2 = s2.substring(0, i8) + interfaceIntToString(executeScript(childInterface, 2)) + s2.substring(i8 + 2); } while (true); do { int j8 = s2.indexOf("%4"); if (j8 == -1) break; - s2 = s2.substring(0, j8) - + interfaceIntToString(executeScript( - childInterface, 3)) + s2 = s2.substring(0, j8) + interfaceIntToString(executeScript(childInterface, 3)) + s2.substring(j8 + 2); } while (true); do { int k8 = s2.indexOf("%5"); if (k8 == -1) break; - s2 = s2.substring(0, k8) - + interfaceIntToString(executeScript( - childInterface, 4)) + s2 = s2.substring(0, k8) + interfaceIntToString(executeScript(childInterface, 4)) + s2.substring(k8 + 2); } while (true); } @@ -10060,21 +9467,16 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw s2 = ""; } if (childInterface.centerText) { - font.method382(yPos, xPos + childInterface.width / 2, s5, - j11, false); + font.method382(yPos, xPos + childInterface.width / 2, s5, j11, false); } else { if (s5.contains("\\r")) { String text = s5.substring(0, s5.indexOf("\\r")); String text2 = s5.substring(s5.indexOf("\\r") + 2); - font.drawTextWithPotentialShadow(false, xPos + 3, 0, - text, j11); - int rightX = boxWidth + xPos - - font.getTextWidth(text2) - 2; - font.drawTextWithPotentialShadow(false, rightX, 0, - text2, j11); + font.drawTextWithPotentialShadow(false, xPos + 3, 0, text, j11); + int rightX = boxWidth + xPos - font.getTextWidth(text2) - 2; + font.drawTextWithPotentialShadow(false, rightX, 0, text2, j11); } else - font.drawTextWithPotentialShadow(false, xPos + 3, 0, - s5, j11); + font.drawTextWithPotentialShadow(false, xPos + 3, 0, s5, j11); } } } @@ -10083,14 +9485,10 @@ private void drawInterface(int scroll_y, int x, Widget rsInterface, int y) throw Rasterizer2D.setDrawingArea(clipBottom, clipLeft, clipRight, clipTop); } - public enum BankTabShow { - FIRST_ITEM_IN_TAB, - DIGIT, - ROMAN_NUMERAL; + FIRST_ITEM_IN_TAB, DIGIT, ROMAN_NUMERAL; } - /** * @author Gabriel aka Swiffy */ @@ -10108,15 +9506,15 @@ private void drawBank(int _x, int currentY) { int final_loop = 1; boolean drawPlus = false; - for(int tab = 0; tab < MAX_BANK_TABS - 1; tab++) { + for (int tab = 0; tab < MAX_BANK_TABS - 1; tab++) { Widget containers = Widget.interfaceCache[50300 + tab]; - //First we search for an item in the tab... + // First we search for an item in the tab... int first_item = -1; int item_amount = 0; - for(int index = 0; index < containers.inventoryItemId.length; index++) { - if(containers.inventoryItemId[index] > 0 && containers.inventoryAmounts[index] > 0) { + for (int index = 0; index < containers.inventoryItemId.length; index++) { + if (containers.inventoryItemId[index] > 0 && containers.inventoryAmounts[index] > 0) { first_item = containers.inventoryItemId[index] - 1; item_amount = containers.inventoryAmounts[index]; break; @@ -10124,29 +9522,29 @@ private void drawBank(int _x, int currentY) { } Widget button = Widget.interfaceCache[id_start + (tab * 4)]; - //Draw the tab if it isn't empty or is id 0 - if(first_item > 0 || tab == 0) { + // Draw the tab if it isn't empty or is id 0 + if (first_item > 0 || tab == 0) { - //If it's currently being viewed, change its sprite - if(tab == currentBankTab || tab == 0 && searchingBank()) { + // If it's currently being viewed, change its sprite + if (tab == currentBankTab || tab == 0 && searchingBank()) { button.disabledSprite = Client.cacheSprite[205]; } else { button.disabledSprite = Client.cacheSprite[206]; } - //We have a tab! Draw it! - settings[1000+tab] = 0; + // We have a tab! Draw it! + settings[1000 + tab] = 0; button.drawingDisabled = false; - //Draw its options - button.actions = new String[]{"Select", tab == 0 ? null : "Collapse", null, null, null}; + // Draw its options + button.actions = new String[] { "Select", tab == 0 ? null : "Collapse", null, null, null }; - //Draw item or tab number - if(tab != 0) { + // Draw item or tab number + if (tab != 0) { Sprite sprite = null; - switch(bankTabShow) { + switch (bankTabShow) { case DIGIT: sprite = cacheSprite[219 + tab]; break; @@ -10155,24 +9553,24 @@ private void drawBank(int _x, int currentY) { break; case ROMAN_NUMERAL: sprite = cacheSprite[210 + tab]; - break; + break; } - if(sprite != null) { - sprite.drawSprite(x+3, y+41); + if (sprite != null) { + sprite.drawSprite(x + 3, y + 41); } } x += 40; } else { - //Empty tab - //We don't have a tab. Remove the button - settings[1000+tab] = 1; + // Empty tab + // We don't have a tab. Remove the button + settings[1000 + tab] = 1; button.drawingDisabled = true; - //Add the draw plus sprite - if(!drawPlus) { + // Add the draw plus sprite + if (!drawPlus) { final_loop = tab; drawPlus = true; } @@ -10180,50 +9578,50 @@ private void drawBank(int _x, int currentY) { } - //Draws a tab and a plus icon after our final bank tab - if(drawPlus) { + // Draws a tab and a plus icon after our final bank tab + if (drawPlus) { - //Show tab - settings[1000+final_loop] = 0; + // Show tab + settings[1000 + final_loop] = 0; - //Show option - Widget.interfaceCache[id_start + (final_loop * 4)].actions = new String[]{"Create Tab", null, null, null, null}; + // Show option + Widget.interfaceCache[id_start + (final_loop * 4)].actions = new String[] { "Create Tab", null, null, null, + null }; Widget.interfaceCache[id_start + (final_loop * 4)].drawingDisabled = false; - //Draw plus icon + // Draw plus icon cacheSprite[210].drawSprite(x, y + 40); } + // Now let's draw the actual bank interface. - //Now let's draw the actual bank interface. - - //First set the proper Y value depending on the scroll position + // First set the proper Y value depending on the scroll position final Widget scrollBar = Widget.interfaceCache[5385]; - if(scrollBar.scrollPosition > 0) { + if (scrollBar.scrollPosition > 0) { y -= scrollBar.scrollPosition; } - //Now reset all children - for(int i = 0; i < scrollBar.children.length; i++) { + // Now reset all children + for (int i = 0; i < scrollBar.children.length; i++) { - //Reset their positioning + // Reset their positioning scrollBar.childX[i] = 40; scrollBar.childY[i] = 0; - //Also make the children invisible + // Also make the children invisible Widget.interfaceCache[scrollBar.children[i]].drawingDisabled = true; } - //Now reset scroll max + // Now reset scroll max scrollBar.scrollMax = 500; - //Now draw the actual bank - if(currentBankTab != 0) { + // Now draw the actual bank + if (currentBankTab != 0) { - //Make the container we're currently viewing visible + // Make the container we're currently viewing visible Widget.interfaceCache[50300 + currentBankTab].drawingDisabled = false; - //Set scroll max + // Set scroll max scrollBar.scrollMax = 1680; } else { @@ -10231,69 +9629,72 @@ private void drawBank(int _x, int currentY) { int containerY = 0; int lineY = y; - for(int i = 0; i < MAX_BANK_TABS - 1; i++) { + for (int i = 0; i < MAX_BANK_TABS - 1; i++) { - //This container is the actual bank tab we're going through in this loop. - //Let's make sure it's visible... + // This container is the actual bank tab we're going through in + // this loop. + // Let's make sure it's visible... Widget container = Widget.interfaceCache[50300 + i]; container.drawingDisabled = false; - //Calculate amount of rows that are occupied in this container + // Calculate amount of rows that are occupied in this container int rows = 0; - label0: for(int j = 0; j < container.inventoryItemId.length; j += 10) { + label0: for (int j = 0; j < container.inventoryItemId.length; j += 10) { - //Is this row empty or not? - //Set to true default + // Is this row empty or not? + // Set to true default boolean emptyRow = true; - //Check the next rows for items... - label1: for(int k = 0; k < container.inventoryItemId.length; k++) { + // Check the next rows for items... + label1: for (int k = 0; k < container.inventoryItemId.length; k++) { - if(j + k >= container.inventoryItemId.length) { + if (j + k >= container.inventoryItemId.length) { break label0; } - //Check for items... - if(container.inventoryItemId[j + k] > 0 && container.inventoryAmounts[j + k] > 0) { + // Check for items... + if (container.inventoryItemId[j + k] > 0 && container.inventoryAmounts[j + k] > 0) { emptyRow = false; break label1; } } - //If the row wasn't empty, increment the amount of rows we have. - if(!emptyRow) { + // If the row wasn't empty, increment the amount of rows we + // have. + if (!emptyRow) { rows++; } } - //Position this container properly + // Position this container properly scrollBar.childY[i] = containerY; - //Increase yDraw so the next container will not be drawn in the same place. + // Increase yDraw so the next container will not be drawn in the + // same place. containerY += 45 * (rows + 1); - //Position the line seperator properly - if(rows == 0) { + // Position the line seperator properly + if (rows == 0) { - //Empty container, small tab!! -// lineY += 25; + // Empty container, small tab!! + // lineY += 25; } else { - //Not empty bank tab. - //Increase scroll max + // Not empty bank tab. + // Increase scroll max scrollBar.scrollMax += rows * 50; - //Increment line draw positioning - if(i == 0) { + // Increment line draw positioning + if (i == 0) { lineY += containerY + 50; } else { lineY += 45 * (rows + 1); } } - //Only draw the line if it's properly inside the bank interface - if(lineY > currentY + 80 && lineY < currentY + 294) { + // Only draw the line if it's properly inside the bank interface + if (lineY > currentY + 80 && lineY < currentY + 294) { Rasterizer2D.drawHorizontalLine(_x + 19, lineY, 450, 0x73654a); } } @@ -10310,16 +9711,15 @@ private void randomizeBackground(IndexedImage background) { anIntArray1190[k] = 0; for (int l = 0; l < 5000; l++) { - int i1 = (int) (Math.random() * 128D * (double) j); + int i1 = (int) (Math.random() * 128D * j); anIntArray1190[i1] = (int) (Math.random() * 256D); } for (int j1 = 0; j1 < 20; j1++) { for (int k1 = 1; k1 < j - 1; k1++) { for (int i2 = 1; i2 < 127; i2++) { int k2 = i2 + (k1 << 7); - anIntArray1191[k2] = (anIntArray1190[k2 - 1] + anIntArray1190[k2 + 1] - + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) - / 4; + anIntArray1191[k2] = (anIntArray1190[k2 - 1] + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + + anIntArray1190[k2 + 128]) / 4; } } @@ -10361,7 +9761,7 @@ private void appendPlayerUpdateMask(int mask, int index, Buffer buffer, Player p player.endForceMovement = endForceMovement; player.direction = direction; - if(animation >= 0) { + if (animation >= 0) { player.emoteAnimation = animation; player.displayedEmoteFrames = 0; player.emoteTimeRemaining = 0; @@ -10370,31 +9770,30 @@ private void appendPlayerUpdateMask(int mask, int index, Buffer buffer, Player p player.anInt1542 = player.remainingPath; } - player.resetPath(); } if ((mask & 0x100) != 0) { player.graphic = buffer.readLEUShort(); int info = buffer.readInt(); player.graphicHeight = info >> 16; - player.graphicDelay = tick + (info & 0xffff); - player.currentAnimation = 0; - player.anInt1522 = 0; - if (player.graphicDelay > tick) - player.currentAnimation = -1; - if (player.graphic == 65535) - player.graphic = -1; - - //Load the gfx... - try { + player.graphicDelay = tick + (info & 0xffff); + player.currentAnimation = 0; + player.anInt1522 = 0; + if (player.graphicDelay > tick) + player.currentAnimation = -1; + if (player.graphic == 65535) + player.graphic = -1; + + // Load the gfx... + try { - if (Frame.animationlist[Graphic.cache[player.graphic].animationSequence.primaryFrames[0] >> 16].length == 0) { - resourceProvider.provide(1, Graphic.cache[player.graphic].animationSequence.primaryFrames[0] >> 16); - } + if (Frame.animationlist[Graphic.cache[player.graphic].animationSequence.primaryFrames[0] >> 16].length == 0) { + resourceProvider.provide(1, Graphic.cache[player.graphic].animationSequence.primaryFrames[0] >> 16); + } - } catch (Exception e) { - // e.printStackTrace(); - } + } catch (Exception e) { + // e.printStackTrace(); + } } if ((mask & 8) != 0) { @@ -10437,8 +9836,8 @@ private void appendPlayerUpdateMask(int mask, int index, Buffer buffer, Player p if ((mask & 0x80) != 0) { int textInfo = buffer.readLEUShort(); int privilege = buffer.readUnsignedByte(); - // int offset = buffer.readNegUByte(); - //int off = buffer.currentPosition; + // int offset = buffer.readNegUByte(); + // int off = buffer.currentPosition; if (player.name != null && player.visible) { long name = StringUtils.encodeBase37(player.name); boolean ignored = false; @@ -10453,28 +9852,30 @@ private void appendPlayerUpdateMask(int mask, int index, Buffer buffer, Player p } if (!ignored && onTutorialIsland == 0) try { - /*chatBuffer.currentPosition = 0; - buffer.readReverseData(chatBuffer.payload, offset, 0); - chatBuffer.currentPosition = 0; - String text = ChatMessageCodec.decode(offset, chatBuffer);*/ + /* + * chatBuffer.currentPosition = 0; + * buffer.readReverseData(chatBuffer.payload, offset, + * 0); chatBuffer.currentPosition = 0; String text = + * ChatMessageCodec.decode(offset, chatBuffer); + */ String text = buffer.readString(); // s = Censor.doCensor(s); player.spokenText = text; player.textColour = textInfo >> 8; - player.rights = privilege; - player.textEffect = textInfo & 0xff; - player.textCycle = 150; - if (privilege == 2 || privilege == 3) - sendMessage(text, 1, "@cr2@" + player.name); - else if (privilege == 1) - sendMessage(text, 1, "@cr1@" + player.name); - else - sendMessage(text, 2, player.name); + player.rights = privilege; + player.textEffect = textInfo & 0xff; + player.textCycle = 150; + if (privilege == 2 || privilege == 3) + sendMessage(text, 1, "@cr2@" + player.name); + else if (privilege == 1) + sendMessage(text, 1, "@cr1@" + player.name); + else + sendMessage(text, 2, player.name); } catch (Exception exception) { SignLink.reporterror("cde2"); } } - // buffer.currentPosition = off + offset; + // buffer.currentPosition = off + offset; } if ((mask & 1) != 0) { player.interactingEntity = buffer.readLEUShort(); @@ -10519,8 +9920,7 @@ private void checkForGameUsages() { try { int j = localPlayer.x + cameraX; int k = localPlayer.y + cameraY; - if (anInt1014 - j < -500 || anInt1014 - j > 500 || anInt1015 - k < -500 - || anInt1015 - k > 500) { + if (anInt1014 - j < -500 || anInt1014 - j > 500 || anInt1015 - k < -500 || anInt1015 - k > 500) { anInt1014 = j; anInt1015 = k; } @@ -10547,66 +9947,47 @@ else if (super.keyArray[4] == 1) if (anInt1184 > 383) anInt1184 = 383; int l = anInt1014 >> 7; - int i1 = anInt1015 >> 7; - int j1 = getCenterHeight(plane, anInt1015, anInt1014); - int k1 = 0; - if (l > 3 && i1 > 3 && l < 100 && i1 < 100) { - for (int l1 = l - 4; l1 <= l + 4; l1++) { - for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) { - int l2 = plane; - if (l2 < 3 && (tileFlags[1][l1][k2] & 2) == 2) - l2++; - int i3 = j1 - tileHeights[l2][l1][k2]; - if (i3 > k1) - k1 = i3; - } - - } - - } - anInt1005++; - if (anInt1005 > 1512) { - anInt1005 = 0; - //unknown (anti-cheat) or maybe cutscene-related - /* outgoing.writeOpcode(77); - outgoing.writeByte(0); - int bufPos = outgoing.currentPosition; - outgoing.writeByte((int) (Math.random() * 256D)); - outgoing.writeByte(101); - outgoing.writeByte(233); - outgoing.writeShort(45092); - - if ((int) (Math.random() * 2D) == 0) { - outgoing.writeShort(35784); - } - - outgoing.writeByte((int) (Math.random() * 256D)); - outgoing.writeByte(64); - outgoing.writeByte(38); - outgoing.writeShort((int) (Math.random() * 65536D)); - outgoing.writeShort((int) (Math.random() * 65536D)); - outgoing.writeBytes(outgoing.currentPosition - bufPos);*/ - } - int j2 = k1 * 192; - if (j2 > 0x17f00) - j2 = 0x17f00; - if (j2 < 32768) - j2 = 32768; - if (j2 > anInt984) { - anInt984 += (j2 - anInt984) / 24; - return; - } - if (j2 < anInt984) { - anInt984 += (j2 - anInt984) / 80; - } + int i1 = anInt1015 >> 7; + int j1 = getCenterHeight(plane, anInt1015, anInt1014); + int k1 = 0; + if (l > 3 && i1 > 3 && l < 100 && i1 < 100) { + for (int l1 = l - 4; l1 <= l + 4; l1++) { + for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) { + int l2 = plane; + if (l2 < 3 && (tileFlags[1][l1][k2] & 2) == 2) + l2++; + int i3 = j1 - tileHeights[l2][l1][k2]; + if (i3 > k1) + k1 = i3; + } + + } + + } + anInt1005++; + if (anInt1005 > 1512) { + anInt1005 = 0; + } + int j2 = k1 * 192; + if (j2 > 0x17f00) + j2 = 0x17f00; + if (j2 < 32768) + j2 = 32768; + if (j2 > anInt984) { + anInt984 += (j2 - anInt984) / 24; + return; + } + if (j2 < anInt984) { + anInt984 += (j2 - anInt984) / 80; + } } catch (Exception _ex) { - SignLink.reporterror("glfc_ex " + localPlayer.x + "," + localPlayer.y + "," - + anInt1014 + "," + anInt1015 + "," + this.regionX + "," + this.regionY - + "," + regionBaseX + "," + regionBaseY); + SignLink.reporterror("glfc_ex " + localPlayer.x + "," + localPlayer.y + "," + anInt1014 + "," + anInt1015 + + "," + this.regionX + "," + this.regionY + "," + regionBaseX + "," + regionBaseY); throw new RuntimeException("eek"); } } + @Override public void processDrawing() { if (rsAlreadyLoaded || loadingError || genericLoadingError) { showErrorScreen(); @@ -10620,11 +10001,14 @@ public void processDrawing() { } private boolean isFriendOrSelf(String s) { - if (s == null) + if (s == null) { return false; - for (int i = 0; i < friendsCount; i++) - if (s.equalsIgnoreCase(friendsList[i])) + } + for (int i = 0; i < friendsCount; i++) { + if (s.equalsIgnoreCase(friendsList[i])) { return true; + } + } return s.equalsIgnoreCase(localPlayer.name); } @@ -10666,42 +10050,45 @@ private void draw3dScreen() { anInt1142++; if (anInt1142 > 67) { anInt1142 = 0; - //sendPacket(new ClearMinimapFlag()); //Not server-sided, flag is only handled in the client + // sendPacket(new ClearMinimapFlag()); //Not server-sided, flag + // is only handled in the client } } if (crossType == 2) { int offSet = frameMode == ScreenMode.FIXED ? 4 : 0; - crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - offSet, - crossY - 8 - offSet); - } - if (openWalkableInterface != -1) {try { - processWidgetAnimations(tickDelta, openWalkableInterface); - if (openWalkableInterface == 197 && frameMode != ScreenMode.FIXED) { - skullIcons[0].drawSprite(frameWidth - 157, 168); - String text = Widget.interfaceCache[199].defaultText.replace("@yel@", ""); - regularText.drawChatInput(0xE1981D, frameWidth - 165, text, 207, true); - } else if (openWalkableInterface == 201 && frameMode != ScreenMode.FIXED) { - drawInterface(0, frameWidth - 560, - Widget.interfaceCache[openWalkableInterface], -109); - } else { - drawInterface(0, frameMode == ScreenMode.FIXED ? 0 : (frameWidth / 2) - 356, - Widget.interfaceCache[openWalkableInterface], - frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230); - } - } catch (Exception ex) { - + crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - offSet, crossY - 8 - offSet); } + if (openWalkableInterface != -1) { + try { + processWidgetAnimations(tickDelta, openWalkableInterface); + if (openWalkableInterface == 197 && frameMode != ScreenMode.FIXED) { + skullIcons[0].drawSprite(frameWidth - 157, 168); + String text = Widget.interfaceCache[199].defaultText.replace("@yel@", ""); + regularText.drawChatInput(0xE1981D, frameWidth - 165, text, 207, true); + } else if (openWalkableInterface == 201 && frameMode != ScreenMode.FIXED) { + drawInterface(0, frameWidth - 560, Widget.interfaceCache[openWalkableInterface], -109); + } else { + drawInterface(0, frameMode == ScreenMode.FIXED ? 0 : (frameWidth / 2) - 356, + Widget.interfaceCache[openWalkableInterface], + frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230); + } + } catch (Exception ex) { + + } } if (openInterfaceId != -1) { try { - if(openInterfaceId == 5292) { + if (openInterfaceId == 5292) { processWidgetAnimations(tickDelta, openInterfaceId); - drawInterface(0, frameMode == ScreenMode.FIXED ? 0 : (frameWidth / 2) - 356, Widget.interfaceCache[openInterfaceId], frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230); - if(openInterfaceId == 5292) { - drawBank(frameMode == ScreenMode.FIXED ? 0 : (frameWidth / 2) - 356, frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230); + drawInterface(0, frameMode == ScreenMode.FIXED ? 0 : (frameWidth / 2) - 356, + Widget.interfaceCache[openInterfaceId], + frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230); + if (openInterfaceId == 5292) { + drawBank(frameMode == ScreenMode.FIXED ? 0 : (frameWidth / 2) - 356, + frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230); } - if(bankItemDragSprite != null) { + if (bankItemDragSprite != null) { bankItemDragSprite.drawSprite(bankItemDragSpriteX, bankItemDragSpriteY); } } else { @@ -10710,7 +10097,7 @@ private void draw3dScreen() { Widget.interfaceCache[openInterfaceId], frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230); } - } catch(Exception e) { + } catch (Exception e) { } } @@ -10718,14 +10105,12 @@ private void draw3dScreen() { processRightClick(); drawTooltip(); } else if (menuScreenArea == 0) { - drawMenu(frameMode == ScreenMode.FIXED ? 4 : 0, - frameMode == ScreenMode.FIXED ? 4 : 0); + drawMenu(frameMode == ScreenMode.FIXED ? 4 : 0, frameMode == ScreenMode.FIXED ? 4 : 0); } if (multicombat == 1) { multiOverlay.drawSprite(frameMode == ScreenMode.FIXED ? 10 : frameWidth - frameWidth + 10, frameHeight - 200); } - drawEffectTimers(); int x = regionBaseX + (localPlayer.x - 6 >> 7); int y = regionBaseY + (localPlayer.y - 6 >> 7); final String screenMode = frameMode == ScreenMode.FIXED ? "Fixed" : "Resizable"; @@ -10735,10 +10120,6 @@ private void draw3dScreen() { if (super.fps < 15) { fpsColour = 0xff0000; } - // regularText.render(textColour, - // "frameWidth: " + (mouseX - frameWidth) + ", frameHeight: " + - // (mouseY - frameHeight), - // frameHeight - 271, 5); regularText.render(textColour, "Client Zoom: " + cameraZoom, 90, frameMode == ScreenMode.FIXED ? 5 : frameWidth - 5); regularText.render(fpsColour, "Fps: " + super.fps, 12, @@ -10747,21 +10128,17 @@ private void draw3dScreen() { int clientMemory = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L); regularText.render(textColour, "Mem: " + clientMemory + "k", 27, frameMode == ScreenMode.FIXED ? 428 : frameWidth - 265); - regularText.render(textColour, - "Mouse X: " + super.mouseX + " , Mouse Y: " + super.mouseY, 30, + regularText.render(textColour, "Mouse X: " + super.mouseX + " , Mouse Y: " + super.mouseY, 30, frameMode == ScreenMode.FIXED ? 5 : frameWidth - 5); regularText.render(textColour, "Coords: " + x + ", " + y, 45, frameMode == ScreenMode.FIXED ? 5 : frameWidth - 5); regularText.render(textColour, "Client Mode: " + screenMode + "", 60, frameMode == ScreenMode.FIXED ? 5 : frameWidth - 5); - regularText.render(textColour, - "Client Resolution: " + frameWidth + "x" + frameHeight, 75, + regularText.render(textColour, "Client Resolution: " + frameWidth + "x" + frameHeight, 75, frameMode == ScreenMode.FIXED ? 5 : frameWidth - 3); - regularText.render(0xffff00, "Object Maps: " + objectMaps, - 115, + regularText.render(0xffff00, "Object Maps: " + objectMaps, 115, frameMode == ScreenMode.FIXED ? 5 : frameWidth - 3); - regularText.render(0xffff00, "Floor Maps: " + floorMaps, - 130, + regularText.render(0xffff00, "Floor Maps: " + floorMaps, 130, frameMode == ScreenMode.FIXED ? 5 : frameWidth - 3); } if (systemUpdateTime != 0) { @@ -10770,70 +10147,57 @@ private void draw3dScreen() { int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 498; seconds %= 60; if (seconds < 10) - regularText.render(0xffff00, - "System update in: " + minutes + ":0" + seconds, 329 + yOffset, - 4); + regularText.render(0xffff00, "System update in: " + minutes + ":0" + seconds, 329 + yOffset, 4); else - regularText.render(0xffff00, "System update in: " + minutes + ":" + seconds, - 329 + yOffset, 4); + regularText.render(0xffff00, "System update in: " + minutes + ":" + seconds, 329 + yOffset, 4); anInt849++; if (anInt849 > 75) { anInt849 = 0; - //unknown (system updating) - //outgoing.writeOpcode(148); - } - } - } - - public void drawOnBankInterface() - { - /*if(openInterfaceId == 5292 && Widget.interfaceCache[27000].defaultText.equals("1")) - { - int total_tabs = Integer.parseInt(Widget.interfaceCache[27001].defaultText); - currentBankTab = Integer.parseInt(Widget.interfaceCache[27002].defaultText); - - for(int k = 0; k <= total_tabs; k++) - { - Widget.interfaceCache[27014 + k].disabledSprite = cacheSprite[123]; - if(k == 0) { - Widget.interfaceCache[27014 + k].actions = new String[]{"Main Tab"}; - } else { - Widget.interfaceCache[27014 + k].actions = new String[]{"Select Tab", "Collapse Tab"}; - } - } - - for(int l = total_tabs + 1; l <= 8; l++) - { - Widget.interfaceCache[27014+ l].disabledSprite = null; - Widget.interfaceCache[27014 + l].tooltip = null; - Widget.interfaceCache[27014 + l].defaultText = null; - } - - if(total_tabs != 8) - { - Widget.interfaceCache[27015 + total_tabs].disabledSprite = cacheSprite[122]; - Widget.interfaceCache[27015 + total_tabs].actions = new String[]{"Create Tab"}; - - } - - if(currentBankTab == -1) - { - Widget.interfaceCache[27013].disabledSprite = cacheSprite[124]; - } else - if(currentBankTab > 0) - { - Widget.interfaceCache[27014 + currentBankTab].disabledSprite = cacheSprite[126]; - Widget.interfaceCache[27014].disabledSprite = cacheSprite[124]; - } else - { - Widget.interfaceCache[27014].disabledSprite = cacheSprite[121]; - } - Widget.interfaceCache[27000].defaultText = "0"; - }*/ + // unknown (system updating) + // outgoing.writeOpcode(148); + } + } + } + + public void drawOnBankInterface() { + /* + * if(openInterfaceId == 5292 && + * Widget.interfaceCache[27000].defaultText.equals("1")) { int + * total_tabs = + * Integer.parseInt(Widget.interfaceCache[27001].defaultText); + * currentBankTab = + * Integer.parseInt(Widget.interfaceCache[27002].defaultText); + * + * for(int k = 0; k <= total_tabs; k++) { Widget.interfaceCache[27014 + + * k].disabledSprite = cacheSprite[123]; if(k == 0) { + * Widget.interfaceCache[27014 + k].actions = new String[]{"Main Tab"}; + * } else { Widget.interfaceCache[27014 + k].actions = new + * String[]{"Select Tab", "Collapse Tab"}; } } + * + * for(int l = total_tabs + 1; l <= 8; l++) { + * Widget.interfaceCache[27014+ l].disabledSprite = null; + * Widget.interfaceCache[27014 + l].tooltip = null; + * Widget.interfaceCache[27014 + l].defaultText = null; } + * + * if(total_tabs != 8) { Widget.interfaceCache[27015 + + * total_tabs].disabledSprite = cacheSprite[122]; + * Widget.interfaceCache[27015 + total_tabs].actions = new + * String[]{"Create Tab"}; + * + * } + * + * if(currentBankTab == -1) { + * Widget.interfaceCache[27013].disabledSprite = cacheSprite[124]; } + * else if(currentBankTab > 0) { Widget.interfaceCache[27014 + + * currentBankTab].disabledSprite = cacheSprite[126]; + * Widget.interfaceCache[27014].disabledSprite = cacheSprite[124]; } + * else { Widget.interfaceCache[27014].disabledSprite = + * cacheSprite[121]; } Widget.interfaceCache[27000].defaultText = "0"; } + */ } public boolean createBankTab() { - if(openInterfaceId != 5292) { + if (openInterfaceId != 5292) { return false; } @@ -10858,53 +10222,44 @@ public boolean createBankTab() { private int bankItemDragSpriteX, bankItemDragSpriteY; private void addIgnore(long name) { - //try { + // try { if (name == 0L) return; sendPacket(new AddIgnore(name)); - /* if (ignoreCount >= 100) { - sendMessage("Your ignore list is full. Max of 100 hit", 0, ""); - return; - } - String s = StringUtils.formatText(StringUtils.decodeBase37(name)); - for (int j = 0; j < ignoreCount; j++) - if (ignoreListAsLongs[j] == name) { - sendMessage(s + " is already on your ignore list", 0, ""); - return; - } - for (int k = 0; k < friendsCount; k++) - if (friendsListAsLongs[k] == name) { - sendMessage("Please remove " + s + " from your friend list first", 0, - ""); - return; - } - - //ignoreListAsLongs[ignoreCount++] = name; - //add ignore - sendPacket(new AddIgnore(name)); - return; - } catch (RuntimeException runtimeexception) { - SignLink.reporterror( - "45688, " + name + ", " + 4 + ", " + runtimeexception.toString()); - } - throw new RuntimeException();*/ + /* + * if (ignoreCount >= 100) { + * sendMessage("Your ignore list is full. Max of 100 hit", 0, ""); + * return; } String s = + * StringUtils.formatText(StringUtils.decodeBase37(name)); for (int j = + * 0; j < ignoreCount; j++) if (ignoreListAsLongs[j] == name) { + * sendMessage(s + " is already on your ignore list", 0, ""); return; } + * for (int k = 0; k < friendsCount; k++) if (friendsListAsLongs[k] == + * name) { sendMessage("Please remove " + s + + * " from your friend list first", 0, ""); return; } + * + * //ignoreListAsLongs[ignoreCount++] = name; //add ignore + * sendPacket(new AddIgnore(name)); return; } catch (RuntimeException + * runtimeexception) { SignLink.reporterror( "45688, " + name + ", " + 4 + * + ", " + runtimeexception.toString()); } throw new + * RuntimeException(); + */ } private void processPlayerMovement() { - for (int index = -1; index < playerCount; index++) { + for (int index = -1; index < playerCount; index++) { - int playerIndex; + int playerIndex; if (index == -1) { playerIndex = internalLocalPlayerIndex; } else { - playerIndex = playerList[index]; + playerIndex = playerList[index]; } Player player = players[playerIndex]; if (player != null) { - processMovement(player); + processMovement(player); } } @@ -10913,35 +10268,28 @@ private void processPlayerMovement() { private void method115() { if (loadingStage == 2) { for (SpawnedObject spawnedObject = (SpawnedObject) spawns - .reverseGetFirst(); spawnedObject != null; spawnedObject = - (SpawnedObject) spawns.reverseGetNext()) { + .reverseGetFirst(); spawnedObject != null; spawnedObject = (SpawnedObject) spawns + .reverseGetNext()) { if (spawnedObject.getLongetivity > 0) spawnedObject.getLongetivity--; if (spawnedObject.getLongetivity == 0) { if (spawnedObject.getPreviousId < 0 - || MapRegion.modelReady(spawnedObject.getPreviousId, - spawnedObject.previousType)) { - removeObject(spawnedObject.y, spawnedObject.plane, - spawnedObject.previousOrientation, - spawnedObject.previousType, spawnedObject.x, - spawnedObject.group, spawnedObject.getPreviousId); + || MapRegion.modelReady(spawnedObject.getPreviousId, spawnedObject.previousType)) { + removeObject(spawnedObject.y, spawnedObject.plane, spawnedObject.previousOrientation, + spawnedObject.previousType, spawnedObject.x, spawnedObject.group, + spawnedObject.getPreviousId); spawnedObject.unlink(); } } else { if (spawnedObject.delay > 0) spawnedObject.delay--; - if (spawnedObject.delay == 0 && spawnedObject.x >= 1 - && spawnedObject.y >= 1 && spawnedObject.x <= 102 - && spawnedObject.y <= 102 - && (spawnedObject.id < 0 || MapRegion.modelReady( - spawnedObject.id, spawnedObject.type))) { - removeObject(spawnedObject.y, spawnedObject.plane, - spawnedObject.orientation, spawnedObject.type, - spawnedObject.x, spawnedObject.group, - spawnedObject.id); + if (spawnedObject.delay == 0 && spawnedObject.x >= 1 && spawnedObject.y >= 1 + && spawnedObject.x <= 102 && spawnedObject.y <= 102 + && (spawnedObject.id < 0 || MapRegion.modelReady(spawnedObject.id, spawnedObject.type))) { + removeObject(spawnedObject.y, spawnedObject.plane, spawnedObject.orientation, + spawnedObject.type, spawnedObject.x, spawnedObject.group, spawnedObject.id); spawnedObject.delay = -1; - if (spawnedObject.id == spawnedObject.getPreviousId - && spawnedObject.getPreviousId == -1) + if (spawnedObject.id == spawnedObject.getPreviousId && spawnedObject.getPreviousId == -1) spawnedObject.unlink(); else if (spawnedObject.id == spawnedObject.getPreviousId && spawnedObject.orientation == spawnedObject.previousOrientation @@ -11028,8 +10376,8 @@ private void updateLocalPlayerMovement(Buffer stream) { if (type == 3) { plane = stream.readBits(2); - //Fix for height changes - if(lastKnownPlane != plane) { + // Fix for height changes + if (lastKnownPlane != plane) { loadingStage = 1; } lastKnownPlane = plane; @@ -11037,7 +10385,6 @@ private void updateLocalPlayerMovement(Buffer stream) { int teleport = stream.readBits(1); int updateRequired = stream.readBits(1); - if (updateRequired == 1) { mobsAwaitingUpdate[mobsAwaitingUpdateCount++] = internalLocalPlayerIndex; } @@ -11077,36 +10424,34 @@ private boolean processWidgetAnimations(int tick, int interfaceId) throws Except boolean redrawRequired = false; Widget widget = Widget.interfaceCache[interfaceId]; - if(widget == null - || widget.children == null) { + if (widget == null || widget.children == null) { return false; } - for (int element : widget.children) { + for (int element : widget.children) { if (element == -1) { break; } - Widget child = Widget.interfaceCache[element]; + Widget child = Widget.interfaceCache[element]; if (child.type == Widget.TYPE_MODEL_LIST) { redrawRequired |= processWidgetAnimations(tick, child.id); } if (child.type == 6 && (child.defaultAnimationId != -1 || child.secondaryAnimationId != -1)) { - boolean updated = interfaceIsSelected(child); + boolean updated = interfaceIsSelected(child); int animationId = updated ? child.secondaryAnimationId : child.defaultAnimationId; if (animationId != -1) { Animation animation = Animation.animations[animationId]; - for (child.lastFrameTime += tick; child.lastFrameTime > animation .duration(child.currentFrame);) { + for (child.lastFrameTime += tick; child.lastFrameTime > animation.duration(child.currentFrame);) { child.lastFrameTime -= animation.duration(child.currentFrame) + 1; child.currentFrame++; if (child.currentFrame >= animation.frameCount) { child.currentFrame -= animation.loopOffset; - if (child.currentFrame < 0 - || child.currentFrame >= animation.frameCount) + if (child.currentFrame < 0 || child.currentFrame >= animation.frameCount) child.currentFrame = 0; } redrawRequired = true; @@ -11125,65 +10470,65 @@ private int setCameraLocation() { int j = 3; if (yCameraCurve < 310) { int k = xCameraPos >> 7; - int l = yCameraPos >> 7; - int i1 = localPlayer.x >> 7; - int j1 = localPlayer.y >> 7; - if ((tileFlags[plane][k][l] & 4) != 0) - j = plane; - int k1; - if (i1 > k) - k1 = i1 - k; - else - k1 = k - i1; - int l1; - if (j1 > l) - l1 = j1 - l; - else - l1 = l - j1; - if (k1 > l1) { - int i2 = (l1 * 0x10000) / k1; - int k2 = 32768; - while (k != i1) { - if (k < i1) - k++; - else if (k > i1) - k--; - if ((tileFlags[plane][k][l] & 4) != 0) - j = plane; - k2 += i2; - if (k2 >= 0x10000) { - k2 -= 0x10000; - if (l < j1) - l++; - else if (l > j1) - l--; - if ((tileFlags[plane][k][l] & 4) != 0) - j = plane; - } - } - } else { - int j2 = (k1 * 0x10000) / l1; - int l2 = 32768; - while (l != j1) { - if (l < j1) - l++; - else if (l > j1) - l--; - if ((tileFlags[plane][k][l] & 4) != 0) - j = plane; - l2 += j2; - if (l2 >= 0x10000) { - l2 -= 0x10000; + int l = yCameraPos >> 7; + int i1 = localPlayer.x >> 7; + int j1 = localPlayer.y >> 7; + if ((tileFlags[plane][k][l] & 4) != 0) + j = plane; + int k1; + if (i1 > k) + k1 = i1 - k; + else + k1 = k - i1; + int l1; + if (j1 > l) + l1 = j1 - l; + else + l1 = l - j1; + if (k1 > l1) { + int i2 = (l1 * 0x10000) / k1; + int k2 = 32768; + while (k != i1) { if (k < i1) k++; else if (k > i1) k--; if ((tileFlags[plane][k][l] & 4) != 0) j = plane; + k2 += i2; + if (k2 >= 0x10000) { + k2 -= 0x10000; + if (l < j1) + l++; + else if (l > j1) + l--; + if ((tileFlags[plane][k][l] & 4) != 0) + j = plane; + } + } + } else { + int j2 = (k1 * 0x10000) / l1; + int l2 = 32768; + while (l != j1) { + if (l < j1) + l++; + else if (l > j1) + l--; + if ((tileFlags[plane][k][l] & 4) != 0) + j = plane; + l2 += j2; + if (l2 >= 0x10000) { + l2 -= 0x10000; + if (k < i1) + k++; + else if (k > i1) + k--; + if ((tileFlags[plane][k][l] & 4) != 0) + j = plane; + } } } } - } if ((tileFlags[plane][localPlayer.x >> 7][localPlayer.y >> 7] & 4) != 0) j = plane; return j; @@ -11191,8 +10536,7 @@ else if (k > i1) private int resetCameraHeight() { int orientation = getCenterHeight(plane, yCameraPos, xCameraPos); - if (orientation - zCameraPos < 800 - && (tileFlags[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0) + if (orientation - zCameraPos < 800 && (tileFlags[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0) return plane; else return 3; @@ -11219,29 +10563,25 @@ private void removeFriendFromList(long name) { } private void removeIgnore(long name) { - // try { + // try { if (name == 0L) return; sendPacket(new DeleteIgnore(name)); - /*for (int index = 0; index < ignoreCount; index++) - if (ignoreListAsLongs[index] == name) { - ignoreCount--; - System.arraycopy(ignoreListAsLongs, index + 1, ignoreListAsLongs, - index, ignoreCount - index); - - // remove ignore - sendPacket(new DeleteIgnore(name)); - return; - } - - return; - } catch (RuntimeException runtimeexception) { - SignLink.reporterror( - "47229, " + 3 + ", " + name + ", " + runtimeexception.toString()); - } - throw new RuntimeException();*/ + /* + * for (int index = 0; index < ignoreCount; index++) if + * (ignoreListAsLongs[index] == name) { ignoreCount--; + * System.arraycopy(ignoreListAsLongs, index + 1, ignoreListAsLongs, + * index, ignoreCount - index); + * + * // remove ignore sendPacket(new DeleteIgnore(name)); return; } + * + * return; } catch (RuntimeException runtimeexception) { + * SignLink.reporterror( "47229, " + 3 + ", " + name + ", " + + * runtimeexception.toString()); } throw new RuntimeException(); + */ } + @Override public String getParameter(String s) { if (SignLink.mainapp != null) return SignLink.mainapp.getParameter(s); @@ -11282,8 +10622,7 @@ private int executeScript(Widget widget, int id) { Widget other = Widget.interfaceCache[script[counter++]]; int item = script[counter++]; if (item >= 0 && item < ItemDefinition.item_count - && (!ItemDefinition.lookup(item).is_members_only - || isMembers)) { + && (!ItemDefinition.lookup(item).is_members_only || isMembers)) { for (int slot = 0; slot < other.inventoryItemId.length; slot++) if (other.inventoryItemId[slot] == item + 1) value += other.inventoryAmounts[slot]; @@ -11316,8 +10655,7 @@ private int executeScript(Widget widget, int id) { Widget other = Widget.interfaceCache[script[counter++]]; int item = script[counter++] + 1; if (item >= 0 && item < ItemDefinition.item_count && isMembers) { - for (int stored = - 0; stored < other.inventoryItemId.length; stored++) { + for (int stored = 0; stored < other.inventoryItemId.length; stored++) { if (other.inventoryItemId[stored] != item) continue; value = 0x3b9ac9ff; @@ -11436,9 +10774,7 @@ private void markMinimap(Sprite sprite, int x, int y) { sprite.drawSprite(((94 + spriteOffsetX) - sprite.maxWidth / 2) + 4 + 30, 83 - spriteOffsetY - sprite.maxHeight / 2 - 4 + 5); } else { - sprite.drawSprite( - ((77 + spriteOffsetX) - sprite.maxWidth / 2) + 4 + 5 - + (frameWidth - 167), + sprite.drawSprite(((77 + spriteOffsetX) - sprite.maxWidth / 2) + 4 + 5 + (frameWidth - 167), 85 - spriteOffsetY - sprite.maxHeight / 2); } } @@ -11455,23 +10791,20 @@ private void drawMinimap() { cacheSprite[45].drawSprite(frameWidth - 158, 7); } if (frameMode == ScreenMode.FIXED - ? super.mouseX >= 519 && super.mouseX <= 536 && super.mouseY >= 22 - && super.mouseY <= 41 - : super.mouseX >= frameWidth - 185 && super.mouseX <= frameWidth - 158 - && super.mouseY >= 40 && super.mouseY <= 66) { + ? super.mouseX >= 519 && super.mouseX <= 536 && super.mouseY >= 22 && super.mouseY <= 41 + : super.mouseX >= frameWidth - 185 && super.mouseX <= frameWidth - 158 && super.mouseY >= 40 + && super.mouseY <= 66) { cacheSprite[23].drawSprite( - Configuration.enableOrbs && frameMode == ScreenMode.FIXED ? 0 - : frameWidth - 185, - frameMode == ScreenMode.FIXED ? 21 : 41); + Configuration.enableOrbs && frameMode == ScreenMode.FIXED ? 0 : frameWidth - 185, + frameMode == ScreenMode.FIXED ? 21 : 41); } else { cacheSprite[22].drawSprite( - Configuration.enableOrbs && frameMode == ScreenMode.FIXED ? 0 - : frameWidth - 185, - frameMode == ScreenMode.FIXED ? 21 : 41); + Configuration.enableOrbs && frameMode == ScreenMode.FIXED ? 0 : frameWidth - 185, + frameMode == ScreenMode.FIXED ? 21 : 41); } if (frameMode != ScreenMode.FIXED && changeTabArea) { - if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 - && super.mouseY >= 2 && super.mouseY <= 24 || tabId == 15) { + if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 && super.mouseY >= 2 + && super.mouseY <= 24 || tabId == 15) { cacheSprite[27].drawSprite(frameWidth - 25, 2); } else { cacheSprite[27].drawAdvancedSprite(frameWidth - 25, 2, 165); @@ -11492,9 +10825,9 @@ private void drawMinimap() { int angle = cameraHorizontal + minimapRotation & 0x7ff; int centreX = 48 + localPlayer.x / 32; int centreY = 464 - localPlayer.y / 32; - minimapImage.rotate(151, angle, minimapLineWidth, 256 + minimapZoom, minimapLeft, - centreY, (frameMode == ScreenMode.FIXED ? 9 : 7), - (frameMode == ScreenMode.FIXED ? 54 : frameWidth - 158), 146, centreX); + minimapImage.rotate(151, angle, minimapLineWidth, 256 + minimapZoom, minimapLeft, centreY, + (frameMode == ScreenMode.FIXED ? 9 : 7), (frameMode == ScreenMode.FIXED ? 54 : frameWidth - 158), 146, + centreX); for (int icon = 0; icon < anInt1071; icon++) { int mapX = (minimapHintX[icon] * 4 + 2) - localPlayer.x / 32; int mapY = (minimapHintY[icon] * 4 + 2) - localPlayer.y / 32; @@ -11524,7 +10857,7 @@ private void drawMinimap() { } } } - for (int p = 0; p < playerCount; p++) { + for (int p = 0; p < playerCount; p++) { Player player = players[playerList[p]]; if (player != null && player.isVisible()) { int mapX = player.x / 32 - localPlayer.x / 32; @@ -11533,8 +10866,7 @@ private void drawMinimap() { boolean clanMember = false; for (int i = 37144; i <= 37244; i++) { - if(Widget.interfaceCache[i].defaultText.toLowerCase(). - contains(player.name.toLowerCase())) { + if (Widget.interfaceCache[i].defaultText.toLowerCase().contains(player.name.toLowerCase())) { clanMember = true; } } @@ -11548,8 +10880,7 @@ private void drawMinimap() { break; } boolean team = false; - if (localPlayer.team != 0 && player.team != 0 - && localPlayer.team == player.team) { + if (localPlayer.team != 0 && player.team != 0 && localPlayer.team == player.team) { team = true; } if (friend) { @@ -11577,8 +10908,7 @@ private void drawMinimap() { int mapY = ((hintIconY - regionBaseY) * 4 + 2) - localPlayer.y / 32; refreshMinimap(mapMarker, mapY, mapX); } - if (hintIconDrawType == 10 && hintIconPlayerId >= 0 - && hintIconPlayerId < players.length) { + if (hintIconDrawType == 10 && hintIconPlayerId >= 0 && hintIconPlayerId < players.length) { Player player = players[hintIconPlayerId]; if (player != null) { int mapX = player.x / 32 - localPlayer.x / 32; @@ -11592,34 +10922,29 @@ private void drawMinimap() { int mapY = (destY * 4 + 2) - localPlayer.y / 32; markMinimap(mapFlag, mapX, mapY); } - Rasterizer2D.drawBox((frameMode == ScreenMode.FIXED ? 127 : frameWidth - 88), (frameMode == ScreenMode.FIXED ? 83 : 80), 3, 3, - 0xffffff); + Rasterizer2D.drawBox((frameMode == ScreenMode.FIXED ? 127 : frameWidth - 88), + (frameMode == ScreenMode.FIXED ? 83 : 80), 3, 3, 0xffffff); if (frameMode == ScreenMode.FIXED) { cacheSprite[19].drawSprite(0, 0); } else { cacheSprite[44].drawSprite(frameWidth - 181, 0); } compass.rotate(33, cameraHorizontal, anIntArray1057, 256, anIntArray968, - (frameMode == ScreenMode.FIXED ? 25 : 24), 4, - (frameMode == ScreenMode.FIXED ? 29 : frameWidth - 176), 33, 25); + (frameMode == ScreenMode.FIXED ? 25 : 24), 4, (frameMode == ScreenMode.FIXED ? 29 : frameWidth - 176), + 33, 25); if (frameMode == ScreenMode.FIXED - ? super.mouseX >= 519 && super.mouseX <= 536 && super.mouseY >= 22 - && super.mouseY <= 41 - : super.mouseX >= frameWidth - 185 && super.mouseX <= frameWidth - 158 - && super.mouseY >= 40 && super.mouseY <= 66) { - cacheSprite[23].drawSprite( - Configuration.enableOrbs && frameMode == ScreenMode.FIXED ? 0 - : frameWidth - 185, - frameMode == ScreenMode.FIXED ? 21 : 41); + ? super.mouseX >= 519 && super.mouseX <= 536 && super.mouseY >= 22 && super.mouseY <= 41 + : super.mouseX >= frameWidth - 185 && super.mouseX <= frameWidth - 158 && super.mouseY >= 40 + && super.mouseY <= 66) { + cacheSprite[23].drawSprite(Configuration.enableOrbs && frameMode == ScreenMode.FIXED ? 0 : frameWidth - 185, + frameMode == ScreenMode.FIXED ? 21 : 41); } else { - cacheSprite[22].drawSprite( - Configuration.enableOrbs && frameMode == ScreenMode.FIXED ? 0 - : frameWidth - 185, - frameMode == ScreenMode.FIXED ? 21 : 41); + cacheSprite[22].drawSprite(Configuration.enableOrbs && frameMode == ScreenMode.FIXED ? 0 : frameWidth - 185, + frameMode == ScreenMode.FIXED ? 21 : 41); } if (frameMode != ScreenMode.FIXED && changeTabArea) { - if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 - && super.mouseY >= 2 && super.mouseY <= 24 || tabId == 10) { + if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 && super.mouseY >= 2 + && super.mouseY <= 24 || tabId == 10) { cacheSprite[27].drawSprite(frameWidth - 25, 2); } else { cacheSprite[27].drawAdvancedSprite(frameWidth - 25, 2, 165); @@ -11638,12 +10963,6 @@ private void loadAllOrbs(int xOffset) { loadHpOrb(xOffset); loadPrayerOrb(xOffset); loadRunOrb(xOffset); - loadSpecialOrb(xOffset); - if (frameMode == ScreenMode.FIXED) { - cacheSprite[worldHover ? 54 : 53].drawSprite(202, 20); - } else { - cacheSprite[worldHover ? 52 : 51].drawSprite(frameWidth - 118, 154); - } } private int poisonType = 0; @@ -11667,13 +10986,11 @@ private void loadHpOrb(int xOffset) { cacheSprite[14].myHeight = (int) (26 * (1 - percent)); cacheSprite[14].drawSprite(27 + xOffset, 45); if (percent <= .25) { - cacheSprite[9].drawSprite1(33 + xOffset, 52, - 200 + (int) (50 * Math.sin(tick / 7.0))); + cacheSprite[9].drawSprite1(33 + xOffset, 52, 200 + (int) (50 * Math.sin(tick / 7.0))); } else { cacheSprite[9].drawSprite(33 + xOffset, 52); } - smallText.method382(getOrbTextColor((int) (percent * 100)), 15 + xOffset, "" + level, - 67, true); + smallText.method382(getOrbTextColor((int) (percent * 100)), 15 + xOffset, "" + level, 67, true); } private void loadPrayerOrb(int xOffset) { @@ -11687,13 +11004,11 @@ private void loadPrayerOrb(int xOffset) { cacheSprite[14].myHeight = (int) (26 * (1 - percent)); cacheSprite[14].drawSprite(27 + xOffset, 89); if (percent <= .25) { - cacheSprite[10].drawSprite1(30 + xOffset, 92, - 200 + (int) (50 * Math.sin(tick / 7.0))); + cacheSprite[10].drawSprite1(30 + xOffset, 92, 200 + (int) (50 * Math.sin(tick / 7.0))); } else { cacheSprite[10].drawSprite(30 + xOffset, 92); } - smallText.method382(getOrbTextColor((int) (percent * 100)), 16 + xOffset, level + "", - 111, true); + smallText.method382(getOrbTextColor((int) (percent * 100)), 16 + xOffset, level + "", 111, true); } private void loadRunOrb(int xOffset) { @@ -11711,26 +11026,7 @@ private void loadRunOrb(int xOffset) { } else { cacheSprite[settings[152] == 1 ? 12 : 11].drawSprite(58 + xOffset, 130); } - smallText.method382(getOrbTextColor((int) (percent * 100)), 40 + xOffset, level + "", - 148, true); - } - - private int specialOrb = 0; - - private void loadSpecialOrb(int xOffset) { - Sprite image = cacheSprite[specialHover ? 56 : 42]; - Sprite fill = cacheSprite[specialEnabled == 0 ? 5 : 6]; - Sprite sword = cacheSprite[55]; - double percent = specialOrb / (double) 100; - boolean isFixed = frameMode == ScreenMode.FIXED; - image.drawSprite((isFixed ? 170 : 159) + xOffset, isFixed ? 122 : 147); - fill.drawSprite((isFixed ? 174 : 163) + xOffset, isFixed ? 126 : 151); - cacheSprite[14].myHeight = (int) (26 * (1 - percent)); - cacheSprite[14].drawSprite((isFixed ? 175 : 163) + xOffset, isFixed ? 127 : 151); - sword.drawSprite((isFixed ? 179 : 168) + xOffset, isFixed ? 131 : 156); - smallText.method382(getOrbTextColor((int) (percent * 100)), - (isFixed ? 212 : 202) + xOffset, specialOrb + "", isFixed ? 148 : 173, - true); + smallText.method382(getOrbTextColor((int) (percent * 100)), 40 + xOffset, level + "", 148, true); } private void npcScreenPos(Mob entity, int i) { @@ -11755,7 +11051,7 @@ private void calcEntityScreenPos(int i, int j, int l) { l = l * i2 - i * l1 >> 16; i = j2; j2 = i1 * k1 - l * j1 >> 16; - l = i1 * j1 + l * k1 >> 16; + l = i1 * j1 + l * k1 >> 16; i1 = j2; if (l >= 50) { spriteDrawX = Rasterizer3D.originViewX + (i << SceneGraph.viewDistance) / l; @@ -11782,23 +11078,20 @@ private void buildSplitPrivateChatMenu() { if (name != null && name.startsWith("@cr2@")) { name = name.substring(5); } - if ((type == 3 || type == 7) && (type == 7 || privateChatMode == 0 - || privateChatMode == 1 && isFriendOrSelf(name))) { + if ((type == 3 || type == 7) + && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name))) { int offSet = frameMode == ScreenMode.FIXED ? 4 : 0; int y = 329 - message * 13; if (frameMode != ScreenMode.FIXED) { y = frameHeight - 170 - message * 13; } - if (super.mouseX > 4 && super.mouseY - offSet > y - 10 - && super.mouseY - offSet <= y + 3) { - int i1 = regularText.getTextWidth( - "From: " + name + chatMessages[index]) + 25; + if (super.mouseX > 4 && super.mouseY - offSet > y - 10 && super.mouseY - offSet <= y + 3) { + int i1 = regularText.getTextWidth("From: " + name + chatMessages[index]) + 25; if (i1 > 450) i1 = 450; if (super.mouseX < 4 + i1) { if (myPrivilege >= 1) { - menuActionText[menuActionRow] = - "Report abuse @whi@" + name; + menuActionText[menuActionRow] = "Report abuse @whi@" + name; menuActionTypes[menuActionRow] = 2606; menuActionRow++; } @@ -11819,11 +11112,11 @@ private void buildSplitPrivateChatMenu() { } - private void requestSpawnObject(int longetivity, int id, int orientation, int group, int y, int type, - int plane, int x, int delay) { + private void requestSpawnObject(int longetivity, int id, int orientation, int group, int y, int type, int plane, + int x, int delay) { SpawnedObject object = null; - for (SpawnedObject node = (SpawnedObject) spawns.reverseGetFirst(); node != null; node = - (SpawnedObject) spawns.reverseGetNext()) { + for (SpawnedObject node = (SpawnedObject) spawns.reverseGetFirst(); node != null; node = (SpawnedObject) spawns + .reverseGetNext()) { if (node.plane != plane || node.x != x || node.y != y || node.group != group) continue; object = node; @@ -11873,31 +11166,26 @@ private void doFlamesDrawing() { if (anInt1040 > 0) { for (int i = 0; i < 256; i++) if (anInt1040 > 768) - anIntArray850[i] = method83(anIntArray851[i], anIntArray852[i], - 1024 - anInt1040); + anIntArray850[i] = method83(anIntArray851[i], anIntArray852[i], 1024 - anInt1040); else if (anInt1040 > 256) anIntArray850[i] = anIntArray852[i]; else - anIntArray850[i] = method83(anIntArray852[i], anIntArray851[i], - 256 - anInt1040); + anIntArray850[i] = method83(anIntArray852[i], anIntArray851[i], 256 - anInt1040); } else if (anInt1041 > 0) { for (int j = 0; j < 256; j++) if (anInt1041 > 768) - anIntArray850[j] = method83(anIntArray851[j], anIntArray853[j], - 1024 - anInt1041); + anIntArray850[j] = method83(anIntArray851[j], anIntArray853[j], 1024 - anInt1041); else if (anInt1041 > 256) anIntArray850[j] = anIntArray853[j]; else - anIntArray850[j] = method83(anIntArray853[j], anIntArray851[j], - 256 - anInt1041); + anIntArray850[j] = method83(anIntArray853[j], anIntArray851[j], 256 - anInt1041); } else { System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256); } - System.arraycopy(flameLeftSprite.myPixels, 0, - flameLeftBackground.canvasRaster, 0, 33920); + System.arraycopy(flameLeftSprite.myPixels, 0, flameLeftBackground.canvasRaster, 0, 33920); int i1 = 0; int j1 = 1152; @@ -11914,10 +11202,8 @@ else if (anInt1041 > 256) int j4 = 256 - j3; j3 = anIntArray850[j3]; int l4 = flameLeftBackground.canvasRaster[j1]; - flameLeftBackground.canvasRaster[j1++] = - ((j3 & 0xff00ff) * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00) - + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 - & 0xff0000) >> 8; + flameLeftBackground.canvasRaster[j1++] = ((j3 & 0xff00ff) * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00) + + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8; } else { j1++; } @@ -11927,8 +11213,7 @@ else if (anInt1041 > 256) } flameLeftBackground.drawGraphics(0, super.graphics, 0); - System.arraycopy(flameRightSprite.myPixels, 0, - flameRightBackground.canvasRaster, 0, 33920); + System.arraycopy(flameRightSprite.myPixels, 0, flameRightBackground.canvasRaster, 0, 33920); i1 = 0; j1 = 1176; @@ -11943,10 +11228,8 @@ else if (anInt1041 > 256) int j5 = 256 - k4; k4 = anIntArray850[k4]; int k5 = flameRightBackground.canvasRaster[j1]; - flameRightBackground.canvasRaster[j1++] = - ((k4 & 0xff00ff) * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00) - + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 - & 0xff0000) >> 8; + flameRightBackground.canvasRaster[j1++] = ((k4 & 0xff00ff) * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00) + + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8; } else { j1++; } @@ -11963,7 +11246,7 @@ private void updateOtherPlayerMovement(Buffer stream) { int count = stream.readBits(8); if (count < playerCount) { - for (int index = count; index < playerCount; index++) { + for (int index = count; index < playerCount; index++) { removedMobs[removedMobCount++] = playerList[index]; } } @@ -11972,8 +11255,8 @@ private void updateOtherPlayerMovement(Buffer stream) { throw new RuntimeException("eek"); } playerCount = 0; - for (int globalIndex = 0; globalIndex < count; globalIndex++) { - int index = playerList[globalIndex]; + for (int globalIndex = 0; globalIndex < count; globalIndex++) { + int index = playerList[globalIndex]; Player player = players[index]; player.index = index; int updateRequired = stream.readBits(1); @@ -11981,7 +11264,7 @@ private void updateOtherPlayerMovement(Buffer stream) { if (updateRequired == 0) { playerList[playerCount++] = index; player.time = tick; - } else { + } else { int movementType = stream.readBits(2); if (movementType == 0) { playerList[playerCount++] = index; @@ -12081,16 +11364,15 @@ private void drawLoginScreen(boolean flag) { int i = c1 / 2 + 80; smallText.method382(0x75a9a9, c / 2, resourceProvider.loadingMessage, i, true); i = c1 / 2 - 20; - boldText.method382(0xffff00, c / 2, "Welcome to " + Configuration.CLIENT_NAME, i, - true); + boldText.method382(0xffff00, c / 2, "Welcome to " + Configuration.CLIENT_NAME, i, true); i += 30; int l = c / 2 - 80; int k1 = c1 / 2 + 20; titleButtonIndexedImage.draw(l - 73, k1 - 20); - boldText.method382(0xffffff, l, "New User", k1 + 5, true); + boldText.method382(0xffffff, l, "Forums", k1 + 5, true); l = c / 2 + 80; titleButtonIndexedImage.draw(l - 73, k1 - 20); - boldText.method382(0xffffff, l, "Existing User", k1 + 5, true); + boldText.method382(0xffffff, l, "Play", k1 + 5, true); } if (loginScreenState == 2) { int j = c1 / 2 - 40; @@ -12103,15 +11385,11 @@ private void drawLoginScreen(boolean flag) { j += 30; } boldText.drawTextWithPotentialShadow(true, c / 2 - 90, 0xffffff, - "Login: " + myUsername - + ((loginScreenCursorPos == 0) & (tick % 40 < 20) - ? "@yel@|" : ""), - j); + "Login: " + myUsername + ((loginScreenCursorPos == 0) & (tick % 40 < 20) ? "@yel@|" : ""), j); j += 15; boldText.drawTextWithPotentialShadow(true, c / 2 - 88, 0xffffff, "Password: " + StringUtils.passwordAsterisks(myPassword) - + ((loginScreenCursorPos == 1) & (tick % 40 < 20) - ? "@yel@|" : ""), + + ((loginScreenCursorPos == 1) & (tick % 40 < 20) ? "@yel@|" : ""), j); j += 15; if (!flag) { @@ -12170,6 +11448,7 @@ private void drawFlames() { drawingFlames = false; } + @Override public void raiseWelcomeScreen() { welcomeScreenRaised = true; } @@ -12186,10 +11465,9 @@ private void parseRegionPackets(Buffer stream, int packetType) { Deque groundItemsDeque = groundItems[plane][xLoc][yLoc]; if (groundItemsDeque != null) { for (Item groundItem = (Item) groundItemsDeque - .reverseGetFirst(); groundItem != null; groundItem = - (Item) groundItemsDeque.reverseGetNext()) { - if (groundItem.ID != (itemId & 0x7fff) - || groundItem.itemCount != oldItemCount) + .reverseGetFirst(); groundItem != null; groundItem = (Item) groundItemsDeque + .reverseGetNext()) { + if (groundItem.ID != (itemId & 0x7fff) || groundItem.itemCount != oldItemCount) continue; groundItem.itemCount = newItemCount; break; @@ -12207,16 +11485,14 @@ private void parseRegionPackets(Buffer stream, int packetType) { int i9 = stream.readUShort(); int l11 = stream.readUnsignedByte(); int i14 = l11 >> 4 & 0xf; - int i16 = l11 & 7; - if (localPlayer.pathX[0] >= k3 - i14 && localPlayer.pathX[0] <= k3 + i14 - && localPlayer.pathY[0] >= j6 - i14 - && localPlayer.pathY[0] <= j6 + i14 && aBoolean848 && !lowMemory - && trackCount < 50) { - tracks[trackCount] = i9; - trackLoops[trackCount] = i16; - soundDelay[trackCount] = Track.delays[i9]; - trackCount++; - } + int i16 = l11 & 7; + if (localPlayer.pathX[0] >= k3 - i14 && localPlayer.pathX[0] <= k3 + i14 && localPlayer.pathY[0] >= j6 - i14 + && localPlayer.pathY[0] <= j6 + i14 && aBoolean848 && !lowMemory && trackCount < 50) { + tracks[trackCount] = i9; + trackLoops[trackCount] = i16; + soundDelay[trackCount] = Track.delays[i9]; + trackCount++; + } } if (packetType == 215) { int i1 = stream.readUShortA(); @@ -12244,9 +11520,8 @@ private void parseRegionPackets(Buffer stream, int packetType) { if (xLoc >= 0 && yLoc >= 0 && xLoc < 104 && yLoc < 104) { Deque groundItemsDeque = groundItems[plane][xLoc][yLoc]; if (groundItemsDeque != null) { - for (Item item = - (Item) groundItemsDeque.reverseGetFirst(); item != null; item = - (Item) groundItemsDeque.reverseGetNext()) { + for (Item item = (Item) groundItemsDeque + .reverseGetFirst(); item != null; item = (Item) groundItemsDeque.reverseGetNext()) { if (item.ID != (itemId & 0x7fff)) continue; item.unlink(); @@ -12274,34 +11549,40 @@ private void parseRegionPackets(Buffer stream, int packetType) { int heightB = tileHeights[plane][xLoc + 1][yLoc]; int heightC = tileHeights[plane][xLoc + 1][yLoc + 1]; int heightD = tileHeights[plane][xLoc][yLoc + 1]; - if (objectGenre == 0) {//WallObject + if (objectGenre == 0) {// WallObject WallObject wallObjectObject = scene.getWallObject(plane, xLoc, yLoc); if (wallObjectObject != null) { int objectId = wallObjectObject.uid >> 14 & 0x7fff; - if (objectType == 2) { - wallObjectObject.renderable1 = new SceneObject(objectId, 4 + objectFace, 2, heightB, heightC, heightA, heightD, animId, false); - wallObjectObject.renderable2 = new SceneObject(objectId, objectFace + 1 & 3, 2, heightB, heightC, heightA, heightD, animId, false); - } else { - wallObjectObject.renderable1 = new SceneObject(objectId, objectFace, objectType, heightB, heightC, heightA, heightD, animId, false); - } + if (objectType == 2) { + wallObjectObject.renderable1 = new SceneObject(objectId, 4 + objectFace, 2, heightB, + heightC, heightA, heightD, animId, false); + wallObjectObject.renderable2 = new SceneObject(objectId, objectFace + 1 & 3, 2, heightB, + heightC, heightA, heightD, animId, false); + } else { + wallObjectObject.renderable1 = new SceneObject(objectId, objectFace, objectType, heightB, + heightC, heightA, heightD, animId, false); + } } } - if (objectGenre == 1) { //WallDecoration + if (objectGenre == 1) { // WallDecoration WallDecoration wallDecoration = scene.getWallDecoration(xLoc, yLoc, plane); if (wallDecoration != null) - wallDecoration.renderable = new SceneObject(wallDecoration.uid >> 14 & 0x7fff, 0, 4, heightB, heightC, heightA, heightD, animId, false); + wallDecoration.renderable = new SceneObject(wallDecoration.uid >> 14 & 0x7fff, 0, 4, heightB, + heightC, heightA, heightD, animId, false); } - if (objectGenre == 2) { //TiledObject + if (objectGenre == 2) { // TiledObject GameObject tiledObject = scene.getGameObject(xLoc, yLoc, plane); if (objectType == 11) objectType = 10; if (tiledObject != null) - tiledObject.renderable = new SceneObject(tiledObject.uid >> 14 & 0x7fff, objectFace, objectType, heightB, heightC, heightA, heightD, animId, false); + tiledObject.renderable = new SceneObject(tiledObject.uid >> 14 & 0x7fff, objectFace, objectType, + heightB, heightC, heightA, heightD, animId, false); } - if (objectGenre == 3) { //GroundDecoration + if (objectGenre == 3) { // GroundDecoration GroundDecoration groundDecoration = scene.getGroundDecoration(yLoc, xLoc, plane); if (groundDecoration != null) - groundDecoration.renderable = new SceneObject(groundDecoration.uid >> 14 & 0x7fff, objectFace, 22, heightB, heightC, heightA, heightD, animId, false); + groundDecoration.renderable = new SceneObject(groundDecoration.uid >> 14 & 0x7fff, objectFace, + 22, heightB, heightC, heightA, heightD, animId, false); } } return; @@ -12369,12 +11650,12 @@ private void parseRegionPackets(Buffer stream, int packetType) { int offset = stream.readUByteA(); int x = localX + (offset >> 4 & 7); int y = localY + (offset & 7); - int id = stream.readLEUShort(); + int id = stream.readLEUShort(); int objectTypeFace = stream.readUByteS(); int type = objectTypeFace >> 2; - int orientation = objectTypeFace & 3; - int group = objectGroups[type]; - if (x >= 0 && y >= 0 && x < 104 && y < 104) { + int orientation = objectTypeFace & 3; + int group = objectGroups[type]; + if (x >= 0 && y >= 0 && x < 104 && y < 104) { requestSpawnObject(-1, id, orientation, group, y, type, plane, x, 0); } return; @@ -12389,8 +11670,8 @@ private void parseRegionPackets(Buffer stream, int packetType) { if (xLoc >= 0 && yLoc >= 0 && xLoc < 104 && yLoc < 104) { xLoc = xLoc * 128 + 64; yLoc = yLoc * 128 + 64; - AnimableObject loneGfx = new AnimableObject(plane, tick, - gfxDelay, gfxId, getCenterHeight(plane, yLoc, xLoc) - gfxHeight, yLoc, xLoc); + AnimableObject loneGfx = new AnimableObject(plane, tick, gfxDelay, gfxId, + getCenterHeight(plane, yLoc, xLoc) - gfxHeight, yLoc, xLoc); incompleteAnimables.insertHead(loneGfx); } return; @@ -12416,7 +11697,7 @@ private void parseRegionPackets(Buffer stream, int packetType) { int objectTypeFace = stream.readNegUByte(); int type = objectTypeFace >> 2; int orientation = objectTypeFace & 3; - int group = objectGroups[type]; + int group = objectGroups[type]; int offset = stream.readUnsignedByte(); int x = localX + (offset >> 4 & 7); int y = localY + (offset & 7); @@ -12439,13 +11720,14 @@ private void parseRegionPackets(Buffer stream, int packetType) { int speed = stream.readUShort(); int initialSlope = stream.readUnsignedByte(); int frontOffset = stream.readUnsignedByte(); - if (x1 >= 0 && y1 >= 0 && x1 < 104 && y1 < 104 && x2 >= 0 && y2 >= 0 - && x2 < 104 && y2 < 104 && gfxMoving != 65535) { + if (x1 >= 0 && y1 >= 0 && x1 < 104 && y1 < 104 && x2 >= 0 && y2 >= 0 && x2 < 104 && y2 < 104 + && gfxMoving != 65535) { x1 = x1 * 128 + 64; y1 = y1 * 128 + 64; x2 = x2 * 128 + 64; y2 = y2 * 128 + 64; - Projectile projectile = new Projectile(initialSlope, endHeight, startDelay + tick, speed + tick, frontOffset, plane, getCenterHeight(plane, y1, x1) - startHeight, y1, x1, target, gfxMoving); + Projectile projectile = new Projectile(initialSlope, endHeight, startDelay + tick, speed + tick, + frontOffset, plane, getCenterHeight(plane, y1, x1) - startHeight, y1, x1, target, gfxMoving); projectile.calculateIncrements(startDelay + tick, y2, getCenterHeight(plane, y2, x2) - endHeight, x2); projectiles.insertHead(projectile); } @@ -12506,29 +11788,29 @@ private void method139(Buffer stream) { private void processLoginScreenInput() { if (loginScreenState == 0) { - if (super.clickMode3 == 1 && super.saveClickX >= 722 && super.saveClickX <= 751 - && super.saveClickY >= 463 && super.saveClickY <= 493) { + if (super.clickMode3 == 1 && super.saveClickX >= 722 && super.saveClickX <= 751 && super.saveClickY >= 463 + && super.saveClickY <= 493) { Configuration.enableMusic = !Configuration.enableMusic; } - /* if (super.clickMode3 == 1 && super.saveClickX >= 7 && super.saveClickX <= 104 - && super.saveClickY >= 464 && super.saveClickY <= 493) { - Configuration.worldSwitch = !Configuration.worldSwitch; - }*/ + /* + * if (super.clickMode3 == 1 && super.saveClickX >= 7 && + * super.saveClickX <= 104 && super.saveClickY >= 464 && + * super.saveClickY <= 493) { Configuration.worldSwitch = + * !Configuration.worldSwitch; } + */ int i = super.myWidth / 2 - 80; int l = super.myHeight / 2 + 20; l += 20; - if (super.clickMode3 == 1 && super.saveClickX >= i - 75 - && super.saveClickX <= i + 75 && super.saveClickY >= l - 20 - && super.saveClickY <= l + 20) { + if (super.clickMode3 == 1 && super.saveClickX >= i - 75 && super.saveClickX <= i + 75 + && super.saveClickY >= l - 20 && super.saveClickY <= l + 20) { loginScreenState = 3; loginScreenCursorPos = 0; } i = super.myWidth / 2 + 80; - if (super.clickMode3 == 1 && super.saveClickX >= i - 75 - && super.saveClickX <= i + 75 && super.saveClickY >= l - 20 - && super.saveClickY <= l + 20) { + if (super.clickMode3 == 1 && super.saveClickX >= i - 75 && super.saveClickX <= i + 75 + && super.saveClickY >= l - 20 && super.saveClickY <= l + 20) { firstLoginMessage = ""; secondLoginMessage = "Enter your username & password."; loginScreenState = 2; @@ -12536,12 +11818,12 @@ private void processLoginScreenInput() { } } else if (loginScreenState == 2) { - if (super.clickMode3 == 1 && super.saveClickX >= 722 && super.saveClickX <= 751 - && super.saveClickY >= 463 && super.saveClickY <= 493) { + if (super.clickMode3 == 1 && super.saveClickX >= 722 && super.saveClickX <= 751 && super.saveClickY >= 463 + && super.saveClickY <= 493) { Configuration.enableMusic = !Configuration.enableMusic; } - if (super.clickMode3 == 1 && super.saveClickX >= 7 && super.saveClickX <= 104 - && super.saveClickY >= 464 && super.saveClickY <= 493) { + if (super.clickMode3 == 1 && super.saveClickX >= 7 && super.saveClickX <= 104 && super.saveClickY >= 464 + && super.saveClickY <= 493) { Configuration.worldSwitch = !Configuration.worldSwitch; } int j = super.myHeight / 2 - 40; @@ -12556,18 +11838,16 @@ private void processLoginScreenInput() { int i1 = super.myWidth / 2 - 80; int k1 = super.myHeight / 2 + 50; k1 += 20; - if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 - && super.saveClickX <= i1 + 75 && super.saveClickY >= k1 - 20 - && super.saveClickY <= k1 + 20) { + if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 && super.saveClickX <= i1 + 75 + && super.saveClickY >= k1 - 20 && super.saveClickY <= k1 + 20) { loginFailures = 0; login(myUsername, myPassword, false); if (loggedIn) return; } i1 = super.myWidth / 2 + 80; - if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 - && super.saveClickX <= i1 + 75 && super.saveClickY >= k1 - 20 - && super.saveClickY <= k1 + 20) { + if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 && super.saveClickX <= i1 + 75 + && super.saveClickY >= k1 - 20 && super.saveClickY <= k1 + 20) { loginScreenState = 0; } do { @@ -12607,9 +11887,8 @@ private void processLoginScreenInput() { int k = super.myWidth / 2; int j1 = super.myHeight / 2 + 50; j1 += 20; - if (super.clickMode3 == 1 && super.saveClickX >= k - 75 - && super.saveClickX <= k + 75 && super.saveClickY >= j1 - 20 - && super.saveClickY <= j1 + 20) + if (super.clickMode3 == 1 && super.saveClickX >= k - 75 && super.saveClickX <= k + 75 + && super.saveClickY >= j1 - 20 && super.saveClickY <= j1 + 20) loginScreenState = 0; } } @@ -12630,54 +11909,51 @@ private void removeObject(int y, int z, int k, int l, int x, int group, int prev if (key != 0) { int config = scene.getMask(z, x, y, key); int id = key >> 14 & 0x7fff; - int objectType = config & 0x1f; - int orientation = config >> 6; - if (group == 0) { - scene.removeWallObject(x, z, y); - ObjectDefinition objectDef = ObjectDefinition.lookup(id); - if (objectDef.solid) - collisionMaps[z].removeObject(orientation, objectType, - objectDef.impenetrable, x, y); - } - if (group == 1) - scene.removeWallDecoration(y, z, x); - if (group == 2) { - scene.removeTiledObject(z, x, y); - ObjectDefinition objectDef = ObjectDefinition.lookup(id); - if (x + objectDef.objectSizeX > 103 || y + objectDef.objectSizeX > 103 - || x + objectDef.objectSizeY > 103 - || y + objectDef.objectSizeY > 103) - return; - if (objectDef.solid) - collisionMaps[z].removeObject(orientation, objectDef.objectSizeX, x, - y, objectDef.objectSizeY, objectDef.impenetrable); - } - if (group == 3) { - scene.removeGroundDecoration(z, y, x); - ObjectDefinition objectDef = ObjectDefinition.lookup(id); - if (objectDef.solid && objectDef.isInteractive) - collisionMaps[z].removeFloorDecoration(y, x); - } + int objectType = config & 0x1f; + int orientation = config >> 6; + if (group == 0) { + scene.removeWallObject(x, z, y); + ObjectDefinition objectDef = ObjectDefinition.lookup(id); + if (objectDef.solid) + collisionMaps[z].removeObject(orientation, objectType, objectDef.impenetrable, x, y); + } + if (group == 1) + scene.removeWallDecoration(y, z, x); + if (group == 2) { + scene.removeTiledObject(z, x, y); + ObjectDefinition objectDef = ObjectDefinition.lookup(id); + if (x + objectDef.objectSizeX > 103 || y + objectDef.objectSizeX > 103 + || x + objectDef.objectSizeY > 103 || y + objectDef.objectSizeY > 103) + return; + if (objectDef.solid) + collisionMaps[z].removeObject(orientation, objectDef.objectSizeX, x, y, objectDef.objectSizeY, + objectDef.impenetrable); + } + if (group == 3) { + scene.removeGroundDecoration(z, y, x); + ObjectDefinition objectDef = ObjectDefinition.lookup(id); + if (objectDef.solid && objectDef.isInteractive) + collisionMaps[z].removeFloorDecoration(y, x); + } } if (previousId >= 0) { int plane = z; if (plane < 3 && (tileFlags[1][x][y] & 2) == 2) plane++; - MapRegion.placeObject(scene, k, y, l, plane, collisionMaps[z], tileHeights, - x, previousId, z); + MapRegion.placeObject(scene, k, y, l, plane, collisionMaps[z], tileHeights, x, previousId, z); } } } - private void updatePlayers(int packetSize, Buffer stream) { - removedMobCount = 0; + private void updatePlayers(int packetSize, Buffer stream) { + removedMobCount = 0; mobsAwaitingUpdateCount = 0; - updateLocalPlayerMovement(stream); - updateOtherPlayerMovement(stream); + updateLocalPlayerMovement(stream); + updateOtherPlayerMovement(stream); updatePlayerList(stream, packetSize); parsePlayerSynchronizationMask(stream); - for (int count = 0; count < removedMobCount; count++) { - int index = removedMobs[count]; + for (int count = 0; count < removedMobCount; count++) { + int index = removedMobs[count]; if (players[index].time != tick) { players[index] = null; @@ -12685,14 +11961,13 @@ private void updatePlayers(int packetSize, Buffer stream) { } if (stream.currentPosition != packetSize) { - SignLink.reporterror("Error packet size mismatch in getplayer pos:" - + stream.currentPosition + " psize:" + packetSize); + SignLink.reporterror( + "Error packet size mismatch in getplayer pos:" + stream.currentPosition + " psize:" + packetSize); throw new RuntimeException("eek"); } - for (int count = 0; count < playerCount; count++) { + for (int count = 0; count < playerCount; count++) { if (players[playerList[count]] == null) { - SignLink.reporterror(myUsername + " null entry in pl list - pos:" + count - + " size:" + playerCount); + SignLink.reporterror(myUsername + " null entry in pl list - pos:" + count + " size:" + playerCount); throw new RuntimeException("eek"); } } @@ -12709,8 +11984,8 @@ private void setCameraPos(int j, int k, int l, int i1, int j1, int k1) { int i3 = Model.SINE[l1]; int k3 = Model.COSINE[l1]; int i4 = k2 * k3 - l2 * i3 >> 16; - l2 = k2 * i3 + l2 * k3 >> 16; - k2 = i4; + l2 = k2 * i3 + l2 * k3 >> 16; + k2 = i4; } if (i2 != 0) { int j3 = Model.SINE[i2]; @@ -12727,7 +12002,8 @@ private void setCameraPos(int j, int k, int l, int i1, int j1, int k1) { } /** - * This method updates default messages upon login to the desired text of the interface text. + * This method updates default messages upon login to the desired text of + * the interface text. */ public void updateStrings(String message, int index) { switch (index) { @@ -12774,7 +12050,7 @@ public void updateStrings(String message, int index) { * Sends a string */ public void sendString(String text, int index) { - if(Widget.interfaceCache[index] == null) { + if (Widget.interfaceCache[index] == null) { return; } Widget.interfaceCache[index].defaultText = text; @@ -12797,7 +12073,7 @@ public void sendButtonClick(int button, int toggle, int type) { } break; - // case reset setting widget + // case reset setting widget case 646: sendPacket(new ClickButton(button)); @@ -12818,8 +12094,7 @@ public void sendButtonClick(int button, int toggle, int type) { break; default: - System.out.println("button: " + button + " - toggle: " + toggle - + " - type: " + type); + System.out.println("button: " + button + " - toggle: " + toggle + " - type: " + type); break; } } @@ -12877,8 +12152,8 @@ public void inventoryOverlay(int interfaceId, int sideInterfaceId) { public void sendPacket(OutgoingPacket packet) { - //Make sure we're logged in and that we can encrypt our packet. - if(!loggedIn || outgoing.getCipher() == null) { + // Make sure we're logged in and that we can encrypt our packet. + if (!loggedIn || outgoing.getCipher() == null) { ping_packet_counter = 0; return; } @@ -12905,7 +12180,7 @@ public void sendPacket(OutgoingPacket packet) { ping_packet_counter = 0; } - private boolean readPacket() { + private boolean readPacket() { if (socketStream == null) { return false; @@ -12918,8 +12193,8 @@ private boolean readPacket() { return false; } - //First we read opcode... - if(opcode == -1) { + // First we read opcode... + if (opcode == -1) { socketStream.flushInputStream(incoming.payload, 1); @@ -12929,14 +12204,13 @@ private boolean readPacket() { opcode = opcode - encryption.getNextKey() & 0xff; } - //Now attempt to read packet size.. + // Now attempt to read packet size.. socketStream.flushInputStream(incoming.payload, 2); - packetSize = ((incoming.payload[0] & 0xff) << 8) - + (incoming.payload[1] & 0xff); + packetSize = ((incoming.payload[0] & 0xff) << 8) + (incoming.payload[1] & 0xff); } - if(!(opcode >= 0 && opcode < 256)) { + if (!(opcode >= 0 && opcode < 256)) { opcode = -1; return false; } @@ -12949,22 +12223,22 @@ private boolean readPacket() { secondLastOpcode = lastOpcode; lastOpcode = opcode; - if(opcode == PacketConstants.INTERFACE_SCROLL_RESET) { + if (opcode == PacketConstants.INTERFACE_SCROLL_RESET) { int interface_ = incoming.readInt(); Widget w = Widget.interfaceCache[interface_]; - if(w != null) { + if (w != null) { w.scrollPosition = 0; } opcode = -1; return true; } - if(opcode == PacketConstants.UPDATE_PLAYER_RIGHTS) { + if (opcode == PacketConstants.UPDATE_PLAYER_RIGHTS) { myPrivilege = incoming.readUnsignedByte(); opcode = -1; return true; } - + if (opcode == PacketConstants.PLAYER_UPDATING) { updatePlayers(packetSize, incoming); validLocalMap = false; @@ -12975,29 +12249,21 @@ private boolean readPacket() { if (opcode == 124) { int skillId = incoming.readUShort(); int gainedXP = incoming.readUShort(); - addToXPCounter(skillId, gainedXP); - opcode = -1; - return true; - } - - if (opcode == 183) { - try { - specialEnabled = incoming.readNegUByte(); - } catch (Exception e) { - e.printStackTrace(); + if (gainedXP > 0) { + addToXPCounter(skillId, gainedXP); } opcode = -1; return true; } - if(opcode == PacketConstants.SEND_CONSOLE_COMMAND) { + if (opcode == PacketConstants.SEND_CONSOLE_COMMAND) { String msg = incoming.readString(); printConsoleMessage(msg, 0); opcode = -1; return true; } - if(opcode == PacketConstants.SHOW_CLANCHAT_OPTIONS) { + if (opcode == PacketConstants.SHOW_CLANCHAT_OPTIONS) { showClanOptions = incoming.readUnsignedByte() == 1; opcode = -1; return true; @@ -13017,8 +12283,7 @@ private boolean readPacket() { character = '\u028F'; reportAbuseInput = ""; canMute = false; - for (int interfaceId = - 0; interfaceId < Widget.interfaceCache.length; interfaceId++) { + for (int interfaceId = 0; interfaceId < Widget.interfaceCache.length; interfaceId++) { if (Widget.interfaceCache[interfaceId] == null || Widget.interfaceCache[interfaceId].contentType != character) continue; @@ -13041,10 +12306,9 @@ private boolean readPacket() { } } for (SpawnedObject object = (SpawnedObject) spawns - .reverseGetFirst(); object != null; object = - (SpawnedObject) spawns.reverseGetNext()) - if (object.x >= localX && object.x < localX + 8 && object.y >= localY - && object.y < localY + 8 && object.plane == plane) + .reverseGetFirst(); object != null; object = (SpawnedObject) spawns.reverseGetNext()) + if (object.x >= localX && object.x < localX + 8 && object.y >= localY && object.y < localY + 8 + && object.plane == plane) object.getLongetivity = 0; opcode = -1; return true; @@ -13054,16 +12318,13 @@ private boolean readPacket() { int playerHeadModelId = incoming.readLEUShortA(); Widget.interfaceCache[playerHeadModelId].defaultMediaType = 3; if (localPlayer.npcDefinition == null) - Widget.interfaceCache[playerHeadModelId].defaultMedia = - (localPlayer.appearanceColors[0] << 25) - + (localPlayer.appearanceColors[4] << 20) - + (localPlayer.equipment[0] << 15) - + (localPlayer.equipment[8] << 10) - + (localPlayer.equipment[11] << 5) - + localPlayer.equipment[1]; + Widget.interfaceCache[playerHeadModelId].defaultMedia = (localPlayer.appearanceColors[0] << 25) + + (localPlayer.appearanceColors[4] << 20) + (localPlayer.equipment[0] << 15) + + (localPlayer.equipment[8] << 10) + (localPlayer.equipment[11] << 5) + + localPlayer.equipment[1]; else - Widget.interfaceCache[playerHeadModelId].defaultMedia = - (int) (0x12345678L + localPlayer.npcDefinition.interfaceType); + Widget.interfaceCache[playerHeadModelId].defaultMedia = (int) (0x12345678L + + localPlayer.npcDefinition.interfaceType); opcode = -1; return true; } @@ -13126,9 +12387,9 @@ private boolean readPacket() { if (skill < currentExp.length) { - if(currentExp[skill] > 0) { + if (currentExp[skill] > 0) { int gainedexp = experience - currentExp[skill]; - if(gainedexp > 0) { + if (gainedexp > 0) { addToXPCounter(skill, gainedexp); } } @@ -13136,13 +12397,10 @@ private boolean readPacket() { currentStats[skill] = level; maximumLevels[skill] = maxLevel; - if(skill == 3 && localPlayer != null) { + if (skill == 3 && localPlayer != null) { localPlayer.currentHealth = level; localPlayer.maxHealth = maxLevel; } - /* for (int index = 0; index < 98; index++) - if (experience >= SKILL_EXPERIENCE[index]) - maximumLevels[skill] = index + 2;*/ } opcode = -1; return true; @@ -13163,8 +12421,7 @@ private boolean readPacket() { int id = incoming.readLEUShort(); if (id == 65535) id = -1; - if (id != currentSong && Configuration.enableMusic && !lowMemory - && prevSong == 0) { + if (id != currentSong && Configuration.enableMusic && !lowMemory && prevSong == 0) { nextSong = id; fadeMusic = true; resourceProvider.provide(2, nextSong); @@ -13205,9 +12462,8 @@ private boolean readPacket() { return true; } - if (opcode == PacketConstants.SEND_MAP_REGION - || opcode == PacketConstants.SEND_REGION_MAP_REGION) { - int regionX = this.regionX; + if (opcode == PacketConstants.SEND_MAP_REGION || opcode == PacketConstants.SEND_REGION_MAP_REGION) { + int regionX = this.regionX; int regionY = this.regionY; if (opcode == 73) { regionX = incoming.readUShortA(); @@ -13216,13 +12472,13 @@ private boolean readPacket() { } else if (opcode == 241) { regionY = incoming.readUShortA(); incoming.initBitAccess(); - for (int z = 0; z < 4; z++) { - for (int x = 0; x < 13; x++) { - for (int y = 0; y < 13; y++) { + for (int z = 0; z < 4; z++) { + for (int x = 0; x < 13; x++) { + for (int y = 0; y < 13; y++) { int visible = incoming.readBits(1); - if (visible == 1) { + if (visible == 1) { localRegions[z][x][y] = incoming.readBits(26); } else { localRegions[z][x][y] = -1; @@ -13242,51 +12498,44 @@ private boolean readPacket() { this.regionY = regionY; regionBaseX = (this.regionX - 6) * 8; regionBaseY = (this.regionY - 6) * 8; - inPlayerOwnedHouse = (this.regionX / 8 == 48 || this.regionX / 8 == 49) - && this.regionY / 8 == 48; + inPlayerOwnedHouse = (this.regionX / 8 == 48 || this.regionX / 8 == 49) && this.regionY / 8 == 48; if (this.regionX / 8 == 48 && this.regionY / 8 == 148) inPlayerOwnedHouse = true; - loadingStage = 1; + loadingStage = 1; loadingStartTime = System.currentTimeMillis(); gameScreenImageProducer.initDrawingArea(); drawLoadingMessages(1, "Loading - please wait.", null); - gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, - super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0); + gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, + frameMode == ScreenMode.FIXED ? 4 : 0); if (opcode == 73) { - int regionCount = 0; - for (int x = (this.regionX - 6) / 8; x <= (this.regionX + 6) - / 8; x++) { - for (int y = (this.regionY - 6) / 8; y <= (this.regionY + 6) - / 8; y++) + int regionCount = 0; + for (int x = (this.regionX - 6) / 8; x <= (this.regionX + 6) / 8; x++) { + for (int y = (this.regionY - 6) / 8; y <= (this.regionY + 6) / 8; y++) regionCount++; } - localRegionMapData = new byte[regionCount][]; - localRegionLandscapeData = new byte[regionCount][]; - localRegionIds = new int[regionCount]; - localRegionMapIds = new int[regionCount]; - localRegionLandscapeIds = new int[regionCount]; - regionCount = 0; - - for (int x = (this.regionX - 6) / 8; x <= (this.regionX + 6) - / 8; x++) { - for (int y = (this.regionY - 6) / 8; y <= (this.regionY + 6) - / 8; y++) { + localRegionMapData = new byte[regionCount][]; + localRegionLandscapeData = new byte[regionCount][]; + localRegionIds = new int[regionCount]; + localRegionMapIds = new int[regionCount]; + localRegionLandscapeIds = new int[regionCount]; + regionCount = 0; + + for (int x = (this.regionX - 6) / 8; x <= (this.regionX + 6) / 8; x++) { + for (int y = (this.regionY - 6) / 8; y <= (this.regionY + 6) / 8; y++) { localRegionIds[regionCount] = (x << 8) + y; - if (inPlayerOwnedHouse && (y == 49 || y == 149 - || y == 147 || x == 50 - || x == 49 && y == 47)) { + if (inPlayerOwnedHouse + && (y == 49 || y == 149 || y == 147 || x == 50 || x == 49 && y == 47)) { localRegionMapIds[regionCount] = -1; localRegionLandscapeIds[regionCount] = -1; - regionCount++; - } else { - int map = localRegionMapIds[regionCount] = - resourceProvider.resolve(0, y, x); + regionCount++; + } else { + int map = localRegionMapIds[regionCount] = resourceProvider.resolve(0, y, x); if (map != -1) { resourceProvider.provide(3, map); } - int landscape = localRegionLandscapeIds[regionCount] = - resourceProvider.resolve(1, y, x); + int landscape = localRegionLandscapeIds[regionCount] = resourceProvider.resolve(1, y, + x); if (landscape != -1) { resourceProvider.provide(3, landscape); } @@ -13300,26 +12549,26 @@ private boolean readPacket() { int regionIds[] = new int[676]; - for (int z = 0; z < 4; z++) { - for (int x = 0; x < 13; x++) { - for (int y = 0; y < 13; y++) { + for (int z = 0; z < 4; z++) { + for (int x = 0; x < 13; x++) { + for (int y = 0; y < 13; y++) { int data = localRegions[z][x][y]; - if (data != -1) { + if (data != -1) { int constructedRegionX = data >> 14 & 0x3ff; - int constructedRegionY = data >> 3 & 0x7ff; - int region = (constructedRegionX / 8 << 8) + constructedRegionY / 8; - for (int index = 0; index < regionCount; index++) { - if (regionIds[index] != region) { - continue; - } - region = -1; - break; - } - if (region != -1) { - regionIds[regionCount++] = region; - } + int constructedRegionY = data >> 3 & 0x7ff; + int region = (constructedRegionX / 8 << 8) + constructedRegionY / 8; + for (int index = 0; index < regionCount; index++) { + if (regionIds[index] != region) { + continue; + } + region = -1; + break; + } + if (region != -1) { + regionIds[regionCount++] = region; + } } } } @@ -13329,32 +12578,34 @@ private boolean readPacket() { localRegionIds = new int[regionCount]; localRegionMapIds = new int[regionCount]; localRegionLandscapeIds = new int[regionCount]; - for (int index = 0; index < regionCount; index++) { - int id = localRegionIds[index] = regionIds[index]; - int constructedRegionX = id >> 8 & 0xff; - int constructedRegionY = id & 0xff; - int map = localRegionMapIds[index] = resourceProvider.resolve(0, constructedRegionY, constructedRegionX); - - if (map != -1) { - resourceProvider.provide(3, map); - } + for (int index = 0; index < regionCount; index++) { + int id = localRegionIds[index] = regionIds[index]; + int constructedRegionX = id >> 8 & 0xff; + int constructedRegionY = id & 0xff; + int map = localRegionMapIds[index] = resourceProvider.resolve(0, constructedRegionY, + constructedRegionX); + + if (map != -1) { + resourceProvider.provide(3, map); + } - int landscape = localRegionLandscapeIds[index] = resourceProvider.resolve(1, constructedRegionY, constructedRegionX); + int landscape = localRegionLandscapeIds[index] = resourceProvider.resolve(1, constructedRegionY, + constructedRegionX); - if (landscape != -1) { - resourceProvider.provide(3, landscape); - } + if (landscape != -1) { + resourceProvider.provide(3, landscape); + } } } - int dx = regionBaseX - previousAbsoluteX; - int dy = regionBaseY - previousAbsoluteY; + int dx = regionBaseX - previousAbsoluteX; + int dy = regionBaseY - previousAbsoluteY; previousAbsoluteX = regionBaseX; previousAbsoluteY = regionBaseY; - for (int index = 0; index < 16384; index++) { + for (int index = 0; index < 16384; index++) { Npc npc = npcs[index]; if (npc != null) { - for (int point = 0; point < 10; point++) { + for (int point = 0; point < 10; point++) { npc.pathX[point] -= dx; npc.pathY[point] -= dy; } @@ -13362,10 +12613,10 @@ private boolean readPacket() { npc.y -= dy * 128; } } - for (int index = 0; index < maxPlayers; index++) { + for (int index = 0; index < maxPlayers; index++) { Player player = players[index]; if (player != null) { - for (int point = 0; point < 10; point++) { + for (int point = 0; point < 10; point++) { player.pathX[point] -= dx; player.pathY[point] -= dy; } @@ -13374,42 +12625,40 @@ private boolean readPacket() { } } validLocalMap = true; - byte startX = 0; - byte endX = 104; - byte stepX = 1; + byte startX = 0; + byte endX = 104; + byte stepX = 1; if (dx < 0) { startX = 103; endX = -1; stepX = -1; } - byte startY = 0; - byte endY = 104; - byte stepY = 1; + byte startY = 0; + byte endY = 104; + byte stepY = 1; if (dy < 0) { startY = 103; endY = -1; stepY = -1; } - for (int x = startX; x != endX; x += stepX) { - for (int y = startY; y != endY; y += stepY) { - int shiftedX = x + dx; - int shiftedY = y + dy; - for (int plane = 0; plane < 4; plane++) + for (int x = startX; x != endX; x += stepX) { + for (int y = startY; y != endY; y += stepY) { + int shiftedX = x + dx; + int shiftedY = y + dy; + for (int plane = 0; plane < 4; plane++) if (shiftedX >= 0 && shiftedY >= 0 && shiftedX < 104 && shiftedY < 104) { groundItems[plane][x][y] = groundItems[plane][shiftedX][shiftedY]; } else { groundItems[plane][x][y] = null; } } - } + } for (SpawnedObject object = (SpawnedObject) spawns - .reverseGetFirst(); object != null; object = - (SpawnedObject) spawns.reverseGetNext()) { + .reverseGetFirst(); object != null; object = (SpawnedObject) spawns.reverseGetNext()) { object.x -= dx; object.y -= dy; - if (object.x < 0 || object.y < 0 - || object.x >= 104 || object.y >= 104) + if (object.x < 0 || object.y < 0 || object.x >= 104 || object.y >= 104) object.unlink(); } if (destinationX != 0) { @@ -13490,9 +12739,9 @@ private boolean readPacket() { return true; } - if(opcode == PacketConstants.SET_AUTOCAST_ID) { + if (opcode == PacketConstants.SET_AUTOCAST_ID) { int auto = incoming.readUShort(); - if(auto == -1) { + if (auto == -1) { autocast = false; autoCastId = 0; } else { @@ -13523,7 +12772,7 @@ private boolean readPacket() { return true; } - if(opcode == PacketConstants.SEND_CLAN_CHAT_MESSAGE) { + if (opcode == PacketConstants.SEND_CLAN_CHAT_MESSAGE) { String message = incoming.readString(); sendMessage(message, 16, ""); opcode = -1; @@ -13570,8 +12819,7 @@ private boolean readPacket() { } if (!ignored && onTutorialIsland == 0) { - String msg = message.substring(message.indexOf(":") + 1, - message.length() - 9); + String msg = message.substring(message.indexOf(":") + 1, message.length() - 9); sendMessage(msg, 8, name); } } else { @@ -13597,19 +12845,17 @@ private boolean readPacket() { if (opcode == PacketConstants.ADD_FRIEND) { long encodedName = incoming.readLong(); int world = incoming.readUnsignedByte(); - String name = StringUtils - .formatText(StringUtils.decodeBase37(encodedName)); + String name = StringUtils.formatText(StringUtils.decodeBase37(encodedName)); for (int playerIndex = 0; playerIndex < friendsCount; playerIndex++) { if (encodedName != friendsListAsLongs[playerIndex]) continue; if (friendsNodeIDs[playerIndex] != world) { friendsNodeIDs[playerIndex] = world; - /*if (world >= 2) { - sendMessage(name + " has logged in.", 5, ""); - } - if (world <= 1) { - sendMessage(name + " has logged out.", 5, ""); - }*/ + /* + * if (world >= 2) { sendMessage(name + + * " has logged in.", 5, ""); } if (world <= 1) { + * sendMessage(name + " has logged out.", 5, ""); } + */ } name = null; @@ -13623,7 +12869,8 @@ private boolean readPacket() { for (boolean stopSorting = false; !stopSorting;) { stopSorting = true; for (int friendIndex = 0; friendIndex < friendsCount - 1; friendIndex++) - if (friendsNodeIDs[friendIndex] != nodeID && friendsNodeIDs[friendIndex + 1] == nodeID || friendsNodeIDs[friendIndex] == 0 && friendsNodeIDs[friendIndex + 1] != 0) { + if (friendsNodeIDs[friendIndex] != nodeID && friendsNodeIDs[friendIndex + 1] == nodeID + || friendsNodeIDs[friendIndex] == 0 && friendsNodeIDs[friendIndex + 1] != 0) { int tempFriendNodeId = friendsNodeIDs[friendIndex]; friendsNodeIDs[friendIndex] = friendsNodeIDs[friendIndex + 1]; friendsNodeIDs[friendIndex + 1] = tempFriendNodeId; @@ -13640,7 +12887,7 @@ private boolean readPacket() { return true; } - if(opcode == PacketConstants.REMOVE_FRIEND) { + if (opcode == PacketConstants.REMOVE_FRIEND) { long nameHash = incoming.readLong(); for (int i = 0; i < friendsCount; i++) { @@ -13676,8 +12923,7 @@ private boolean readPacket() { for (int index = 0; index < ignoreCount; index++) { if (ignoreListAsLongs[index] == nameHash) { ignoreCount--; - System.arraycopy(ignoreListAsLongs, index + 1, ignoreListAsLongs, - index, ignoreCount - index); + System.arraycopy(ignoreListAsLongs, index + 1, ignoreListAsLongs, index, ignoreCount - index); break; } } @@ -13700,32 +12946,35 @@ private boolean readPacket() { if (opcode == PacketConstants.SEND_HINT_ICON) { // the first byte, which indicates the type of mob hintIconDrawType = incoming.readUnsignedByte(); - if (hintIconDrawType == 1) //NPC Hint Arrow - // the world index or slot of the npc in the server (which is also the same for the client (should)) + if (hintIconDrawType == 1) // NPC Hint Arrow + // the world index or slot of the npc in the server (which + // is also the same for the client (should)) hintIconNpcId = incoming.readUShort(); - if (hintIconDrawType >= 2 && hintIconDrawType <= 6) { //Location Hint Arrow - if (hintIconDrawType == 2) { //Center + if (hintIconDrawType >= 2 && hintIconDrawType <= 6) { // Location + // Hint + // Arrow + if (hintIconDrawType == 2) { // Center hintIconLocationArrowRelX = 64; hintIconLocationArrowRelY = 64; } - if (hintIconDrawType == 3) { //West side + if (hintIconDrawType == 3) { // West side hintIconLocationArrowRelX = 0; hintIconLocationArrowRelY = 64; } - if (hintIconDrawType == 4) { //East side + if (hintIconDrawType == 4) { // East side hintIconLocationArrowRelX = 128; hintIconLocationArrowRelY = 64; } - if (hintIconDrawType == 5) { //South side + if (hintIconDrawType == 5) { // South side hintIconLocationArrowRelX = 64; hintIconLocationArrowRelY = 0; } - if (hintIconDrawType == 6) { //North side + if (hintIconDrawType == 6) { // North side hintIconLocationArrowRelX = 64; hintIconLocationArrowRelY = 128; } hintIconDrawType = 2; - //x offset + // x offset hintIconX = incoming.readUShort(); // y offset @@ -13734,13 +12983,16 @@ private boolean readPacket() { // z offset hintIconLocationArrowHeight = incoming.readUnsignedByte(); } - if (hintIconDrawType == 10) //Player Hint Arrow + if (hintIconDrawType == 10) // Player Hint Arrow hintIconPlayerId = incoming.readUShort(); opcode = -1; return true; } - if (opcode == PacketConstants.SEND_DUO_INTERFACE) { //Send Duo Interface: Main + Sidebar + if (opcode == PacketConstants.SEND_DUO_INTERFACE) { // Send Duo + // Interface: + // Main + + // Sidebar int mainInterfaceId = incoming.readUShortA(); int sidebarOverlayInterfaceId = incoming.readUShort(); if (backDialogueId != -1) { @@ -13803,20 +13055,17 @@ private boolean readPacket() { privateMessageIds[privateMessageCount] = messageId; privateMessageCount = (privateMessageCount + 1) % 100; String message = incoming.readString(); - //ChatMessageCodec.decode(packetSize - 13, incoming); + // ChatMessageCodec.decode(packetSize - 13, incoming); // if(l21 != 3) // s9 = Censor.doCensor(s9); if (rights == 2 || rights == 3) - sendMessage(message, 7, "@cr2@" - + StringUtils.formatText(StringUtils - .decodeBase37(encodedName))); + sendMessage(message, 7, + "@cr2@" + StringUtils.formatText(StringUtils.decodeBase37(encodedName))); else if (rights == 1) - sendMessage(message, 7, "@cr1@" - + StringUtils.formatText(StringUtils - .decodeBase37(encodedName))); + sendMessage(message, 7, + "@cr1@" + StringUtils.formatText(StringUtils.decodeBase37(encodedName))); else - sendMessage(message, 3, StringUtils.formatText( - StringUtils.decodeBase37(encodedName))); + sendMessage(message, 3, StringUtils.formatText(StringUtils.decodeBase37(encodedName))); } catch (Exception ex) { SignLink.reporterror("cde1"); } @@ -13857,8 +13106,7 @@ else if (rights == 1) Widget.interfaceCache[widget].defaultMedia = item; Widget.interfaceCache[widget].modelRotation1 = definition.rotation_y; Widget.interfaceCache[widget].modelRotation2 = definition.rotation_y; - Widget.interfaceCache[widget].modelZoom = - (definition.model_zoom * 100) / scale; + Widget.interfaceCache[widget].modelZoom = (definition.model_zoom * 100) / scale; opcode = -1; return true; } @@ -13890,27 +13138,16 @@ else if (rights == 1) opcode = -1; return true; } - - if (opcode == 137) { - specialOrb = incoming.readUnsignedByte(); - opcode = -1; - return true; - } - if (opcode == PacketConstants.SET_INTERFACE_TEXT) { try { - String text = incoming.readString(); int id = incoming.readInt(); - - // System.out.println("Text: "+text+", id: "+id); + // System.out.println("Text: "+text+", id: "+id); if (text.startsWith("www.") || text.startsWith("http://")) { MiscUtils.launchURL(text); } - - // updateStrings(text, id); + // updateStrings(text, id); sendString(text, id); - } catch (Exception e) { e.printStackTrace(); } @@ -13946,10 +13183,9 @@ else if (rights == 1) int id = incoming.readLEUShortA(); int color = incoming.readLEUShortA(); int red = color >> 10 & 0x1f; - int green = color >> 5 & 0x1f; + int green = color >> 5 & 0x1f; int blue = color & 0x1f; - Widget.interfaceCache[id].textColor = - (red << 19) + (green << 11) + (blue << 3); + Widget.interfaceCache[id].textColor = (red << 19) + (green << 11) + (blue << 3); opcode = -1; return true; } @@ -13961,18 +13197,18 @@ else if (rights == 1) int itemCount = incoming.readShort(); Widget widget = Widget.interfaceCache[interfaceId]; - if(widget == null || widget.inventoryItemId == null || widget.inventoryAmounts == null) { + if (widget == null || widget.inventoryItemId == null || widget.inventoryAmounts == null) { opcode = -1; return true; } for (int j22 = 0; j22 < itemCount; j22++) { - if(j22 == widget.inventoryItemId.length) { + if (j22 == widget.inventoryItemId.length) { break; } int amount = incoming.readInt(); - if(amount == 0) { + if (amount == 0) { widget.inventoryItemId[j22] = -1; } else { widget.inventoryItemId[j22] = incoming.readShort(); @@ -13986,15 +13222,15 @@ else if (rights == 1) widget.inventoryAmounts[slot] = 0; } - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } opcode = -1; return true; } - if(opcode == PacketConstants.SEND_CURRENT_BANK_TAB) { - currentBankTab = incoming.readUnsignedByte(); + if (opcode == PacketConstants.SEND_CURRENT_BANK_TAB) { + currentBankTab = incoming.readUnsignedByte(); opcode = -1; return true; } @@ -14007,7 +13243,7 @@ else if (rights == 1) addEffectTimer(new EffectTimer(timer, sprite)); - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } opcode = -1; @@ -14032,7 +13268,9 @@ else if (rights == 1) return true; } - if (opcode == PacketConstants.MOVE_CAMERA) { //Gradually turn camera to spatial point. + if (opcode == PacketConstants.MOVE_CAMERA) { // Gradually turn + // camera to spatial + // point. oriented = true; cinematicCamXViewpointLoc = incoming.readUnsignedByte(); cinematicCamYViewpointLoc = incoming.readUnsignedByte(); @@ -14042,15 +13280,14 @@ else if (rights == 1) if (varCinematicCamRotationSpeedPromille >= 100) { int cinCamXViewpointPos = cinematicCamXViewpointLoc * 128 + 64; int cinCamYViewpointPos = cinematicCamYViewpointLoc * 128 + 64; - int cinCamZViewpointPos = getCenterHeight(plane, cinCamYViewpointPos, cinCamXViewpointPos) - cinematicCamZViewpointLoc; + int cinCamZViewpointPos = getCenterHeight(plane, cinCamYViewpointPos, cinCamXViewpointPos) + - cinematicCamZViewpointLoc; int dXPos = cinCamXViewpointPos - xCameraPos; int dYPos = cinCamYViewpointPos - yCameraPos; int dZPos = cinCamZViewpointPos - zCameraPos; int flatDistance = (int) Math.sqrt(dXPos * dXPos + dYPos * dYPos); - yCameraCurve = (int) (Math.atan2(dZPos, flatDistance) * 325.94900000000001D) - & 0x7ff; - xCameraCurve = (int) (Math.atan2(dXPos, dYPos) * -325.94900000000001D) - & 0x7ff; + yCameraCurve = (int) (Math.atan2(dZPos, flatDistance) * 325.94900000000001D) & 0x7ff; + xCameraCurve = (int) (Math.atan2(dXPos, dYPos) * -325.94900000000001D) & 0x7ff; if (yCameraCurve < 128) yCameraCurve = 128; if (yCameraCurve > 383) @@ -14084,7 +13321,10 @@ else if (rights == 1) return true; } - if (opcode == PacketConstants.SEND_ENTER_NAME) { //Send Enter Name Dialogue (still allows numbers) + if (opcode == PacketConstants.SEND_ENTER_NAME) { // Send Enter Name + // Dialogue + // (still allows + // numbers) String title = incoming.readString(); enter_name_title = title; messagePromptRaised = false; @@ -14146,7 +13386,7 @@ else if (rights == 1) if (opcode == PacketConstants.SEND_CONFIG_BYTE) { int id = incoming.readLEUShort(); byte value = incoming.readSignedByte(); - if(id < anIntArray1045.length) { + if (id < anIntArray1045.length) { anIntArray1045[id] = value; if (settings[id] != value) { settings[id] = value; @@ -14160,7 +13400,7 @@ else if (rights == 1) } if (opcode == PacketConstants.SEND_MULTICOMBAT_ICON) { - multicombat = incoming.readUnsignedByte(); //1 is active + multicombat = incoming.readUnsignedByte(); // 1 is active opcode = -1; return true; } @@ -14199,18 +13439,18 @@ else if (rights == 1) int slot = incoming.readUnsignedByte(); int amount = incoming.readInt(); int id = incoming.readUShort(); - if(id == 65535 || id < 0) { + if (id == 65535 || id < 0) { id = 0; } - if(amount < 0) { + if (amount < 0) { amount = 0; } - if(widget == null || widget.inventoryItemId == null) { + if (widget == null || widget.inventoryItemId == null) { opcode = -1; return true; } - if (slot >= 0 && slot < widget.inventoryItemId.length) { + if (slot >= 0 && slot < widget.inventoryItemId.length) { widget.inventoryItemId[slot] = id; widget.inventoryAmounts[slot] = amount; } @@ -14219,8 +13459,11 @@ else if (rights == 1) return true; } - if (opcode == PacketConstants.SEND_GFX || opcode == PacketConstants.SEND_GROUND_ITEM || opcode == PacketConstants.SEND_ALTER_GROUND_ITEM_COUNT || opcode == PacketConstants.SEND_REMOVE_OBJECT || opcode == 105 - || opcode == PacketConstants.SEND_PROJECTILE || opcode == PacketConstants.TRANSFORM_PLAYER_TO_OBJECT || opcode == PacketConstants.SEND_OBJECT || opcode == PacketConstants.SEND_REMOVE_GROUND_ITEM + if (opcode == PacketConstants.SEND_GFX || opcode == PacketConstants.SEND_GROUND_ITEM + || opcode == PacketConstants.SEND_ALTER_GROUND_ITEM_COUNT + || opcode == PacketConstants.SEND_REMOVE_OBJECT || opcode == 105 + || opcode == PacketConstants.SEND_PROJECTILE || opcode == PacketConstants.TRANSFORM_PLAYER_TO_OBJECT + || opcode == PacketConstants.SEND_OBJECT || opcode == PacketConstants.SEND_REMOVE_GROUND_ITEM || opcode == PacketConstants.ANIMATE_OBJECT || opcode == 215) { parseRegionPackets(incoming, opcode); opcode = -1; @@ -14249,16 +13492,15 @@ else if (rights == 1) return true; } - SignLink.reporterror("T1 - " + opcode + "," + packetSize + " - " - + secondLastOpcode + "," + thirdLastOpcode); + SignLink.reporterror( + "T1 - " + opcode + "," + packetSize + " - " + secondLastOpcode + "," + thirdLastOpcode); resetLogout(); } catch (IOException _ex) { dropClient(); _ex.printStackTrace(); } catch (Exception exception) { - String s2 = "T2 - " + opcode + "," + secondLastOpcode + "," + thirdLastOpcode - + " - " + packetSize + "," + (regionBaseX + localPlayer.pathX[0]) - + "," + (regionBaseY + localPlayer.pathY[0]) + " - "; + String s2 = "T2 - " + opcode + "," + secondLastOpcode + "," + thirdLastOpcode + " - " + packetSize + "," + + (regionBaseX + localPlayer.pathX[0]) + "," + (regionBaseY + localPlayer.pathY[0]) + " - "; for (int j15 = 0; j15 < packetSize && j15 < 50; j15++) s2 = s2 + incoming.payload[j15] + ","; SignLink.reporterror(s2); @@ -14288,11 +13530,9 @@ private void moveCameraWithPlayer() { i = quakeAmplitudes[4] + 128; int k = cameraHorizontal + cameraRotation & 0x7ff; setCameraPos( - cameraZoom + i * ((SceneGraph.viewDistance == 9) - && (frameMode == ScreenMode.RESIZABLE) ? 2 - : SceneGraph.viewDistance == 10 ? 5 : 3), - i, anInt1014, getCenterHeight(plane, localPlayer.y, localPlayer.x) - 50, k, - anInt1015); + cameraZoom + i * ((SceneGraph.viewDistance == 9) && (frameMode == ScreenMode.RESIZABLE) ? 2 + : SceneGraph.viewDistance == 10 ? 5 : 3), + i, anInt1014, getCenterHeight(plane, localPlayer.y, localPlayer.x) - 50, k, anInt1015); } int j; if (!oriented) @@ -14306,11 +13546,8 @@ i, anInt1014, getCenterHeight(plane, localPlayer.y, localPlayer.x) - 50, k, int l1 = xCameraCurve; for (int i2 = 0; i2 < 5; i2++) if (quakeDirectionActive[i2]) { - int j2 = (int) ((Math.random() * (double) (quakeMagnitudes[i2] * 2 + 1) - - (double) quakeMagnitudes[i2]) + Math - .sin((double) quakeTimes[i2] - * ((double) quake4PiOverPeriods[i2] / 100D)) - * (double) quakeAmplitudes[i2]); + int j2 = (int) ((Math.random() * (quakeMagnitudes[i2] * 2 + 1) - quakeMagnitudes[i2]) + + Math.sin(quakeTimes[i2] * (quake4PiOverPeriods[i2] / 100D)) * quakeAmplitudes[i2]); if (i2 == 0) xCameraPos += j2; if (i2 == 1) @@ -14335,13 +13572,6 @@ i, anInt1014, getCenterHeight(plane, localPlayer.y, localPlayer.x) - 50, k, Rasterizer2D.clear(); scene.render(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve); scene.clearGameObjectCache(); - if (Configuration.enableFog) { - double fogDistance = Math.sqrt(Math.pow(zCameraPos, 2)); - int fogStartDistance = 1330; - int fogEndDistance = 2100; - fog.setFogDistance((float) fogDistance); - fog.renderFog(false, fogStartDistance, fogEndDistance, 3); - } updateEntities(); drawHeadIcon(); writeBackgroundTexture(k2); @@ -14354,8 +13584,8 @@ i, anInt1014, getCenterHeight(plane, localPlayer.y, localPlayer.x) - 50, k, drawMinimap(); drawTabArea(); } - gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, - super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0); + gameScreenImageProducer.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, + frameMode == ScreenMode.FIXED ? 4 : 0); xCameraPos = l; zCameraPos = i1; yCameraPos = j1; @@ -14368,17 +13598,16 @@ private void processMinimapActions() { return; } final boolean fixed = frameMode == ScreenMode.FIXED; - if (fixed ? super.mouseX >= 542 && super.mouseX <= 579 && super.mouseY >= 2 - && super.mouseY <= 38 - : super.mouseX >= frameWidth - 180 && super.mouseX <= frameWidth - 139 - && super.mouseY >= 0 && super.mouseY <= 40) { + if (fixed ? super.mouseX >= 542 && super.mouseX <= 579 && super.mouseY >= 2 && super.mouseY <= 38 + : super.mouseX >= frameWidth - 180 && super.mouseX <= frameWidth - 139 && super.mouseY >= 0 + && super.mouseY <= 40) { menuActionText[1] = "Face North"; menuActionTypes[1] = 696; menuActionRow = 2; } if (frameMode != ScreenMode.FIXED && changeTabArea) { - if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 - && super.mouseY >= 2 && super.mouseY <= 24) { + if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 && super.mouseY >= 2 + && super.mouseY <= 24) { menuActionText[1] = "Logout"; menuActionTypes[1] = 700; menuActionRow = 2; @@ -14389,20 +13618,13 @@ private void processMinimapActions() { menuActionTypes[1] = 850; menuActionRow = 2; } - if (specialHover && Configuration.enableOrbs) { - menuActionText[1] = "Use Special Attack"; - menuActionTypes[1] = 851; - menuActionRow = 2; - } if (hpHover && Configuration.enableOrbs) { - menuActionText[1] = Configuration.hpAboveHeads ? "Turn HP Above Heads on" - : "Turn HP Above Heads off"; + menuActionText[1] = Configuration.hpAboveHeads ? "Turn HP Above Heads on" : "Turn HP Above Heads off"; menuActionTypes[1] = 1508; menuActionRow = 2; } if (prayHover && Configuration.enableOrbs) { - menuActionText[2] = - prayClicked ? "Turn quick-prayers off" : "Turn quick-prayers on"; + menuActionText[2] = prayClicked ? "Turn quick-prayers off" : "Turn quick-prayers on"; menuActionTypes[2] = 1500; menuActionRow = 2; menuActionText[1] = "Select quick-prayers"; @@ -14417,64 +13639,62 @@ private void processMinimapActions() { } private void drawCounterOnScreen() { - RSFont xp_font = newBoldFont; + RSFont xp_font = newSmallFont; int font_height = 24; - int x = 510; - int y = - 100; + int x = 500; + int y = -100; digits = xpCounter == 0 ? 1 : 1 + (int) Math.floor(Math.log10(xpCounter)); int lengthToRemove = Integer.toString(xpCounter).length(); - int i = regularText.getTextWidth(Integer.toString(xpCounter)) - regularText.getTextWidth(Integer.toString(xpCounter)) / 2; + int i = regularText.getTextWidth(Integer.toString(xpCounter)) + - regularText.getTextWidth(Integer.toString(xpCounter)) / 2; int a = lengthToRemove == 1 ? 5 : ((lengthToRemove - 1) * 5); - final boolean wilderness = openWalkableInterface == 23300; - - for(i = 0; i < xp_added.length; i++) { - if(xp_added[i][0] > -1) { - if(xp_added[i][2] >= 0) { + for (i = 0; i < xp_added.length; i++) { + if (xp_added[i][0] > -1) { + if (xp_added[i][2] >= 0) { int transparency = 256; - if(xp_added[i][2] > 120) - transparency = (10-(xp_added[i][2]-120)) * 256 / 20; - if(transparency > 0) { - String s = "+"+NumberFormat.getIntegerInstance().format(xp_added[i][1]) + " xp"; + if (xp_added[i][2] > 120) + transparency = (10 - (xp_added[i][2] - 120)) * 256 / 20; + if (transparency > 0) { + String s = "" + + NumberFormat.getIntegerInstance().format(xp_added[i][1]); int icons_x_off = 0; Sprite sprite = null; - for(int i2 = 0; i2 < skill_sprites.length; i2++) { - if((xp_added[i][0] & (1 << i2)) == 0) continue; - + for (int i2 = 0; i2 < skill_sprites.length; i2++) { + if ((xp_added[i][0] & (1 << i2)) == 0) { + continue; + } sprite = skill_sprites[i2]; icons_x_off += sprite.myWidth + 3; - sprite.drawSprite(x - a + 12 - xp_font.getTextWidth(s) - icons_x_off, y + 157 + (140-xp_added[i][2]) - (font_height/2) - (sprite.myHeight/2), transparency); + sprite.drawSprite(x - a + 12 - xp_font.getTextWidth(s) - icons_x_off, + y + 157 + (140 - xp_added[i][2]) - (font_height / 2) - (sprite.myHeight / 2), + transparency); } - xp_font.drawBasicString(s, x - a + 12 - xp_font.getTextWidth(s), y + 150 + (140-xp_added[i][2]), 0xFF9900, -1); + xp_font.drawBasicString(s, x - a + 12 - xp_font.getTextWidth(s), + y + 150 + (140 - xp_added[i][2]), 0xFFFFFF, -1); } } - xp_added[i][2]++; - - - if(xp_added[i][2] >= (wilderness ? 75 : 240)) + if (xp_added[i][2] >= (wilderness ? 75 : 240)) { xp_added[i][0] = -1; + } } } } - private int specialEnabled = 0; - public boolean isPoisoned, clickedQuickPrayers; public final int[] // Perfected (Hp, pray and run orb) - orbX = {0, 0, 24}, orbY = {41, 85, 122}, orbTextX = {15, 16, 40}, orbTextY = {67, 111, 148}, - coloredOrbX = {27, 27, 51}, coloredOrbY = {45, 89, 126}, - currentInterface = {4016, 4012, 149}, maximumInterface = {4017, 4013, 149}, - orbIconX = {33, 30, 58}, orbIconY = {51, 92, 130}; + orbX = { 0, 0, 24 }, orbY = { 41, 85, 122 }, orbTextX = { 15, 16, 40 }, orbTextY = { 67, 111, 148 }, + coloredOrbX = { 27, 27, 51 }, coloredOrbY = { 45, 89, 126 }, currentInterface = { 4016, 4012, 149 }, + maximumInterface = { 4017, 4013, 149 }, orbIconX = { 33, 30, 58 }, orbIconY = { 51, 92, 130 }; public int digits = 0; public int xpCounter, xpAddedPos, expAdded; - private boolean runHover, prayHover, hpHover, prayClicked, - specialHover, worldHover, autocast; + private boolean runHover, prayHover, hpHover, prayClicked, worldHover, autocast; public int getOrbTextColor(int statusInt) { if (statusInt >= 75 && statusInt <= Integer.MAX_VALUE) @@ -14851,7 +14071,7 @@ public Client() { private volatile boolean drawingFlames; private int spriteDrawX; private int spriteDrawY; - private final int[] anIntArray965 = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff}; + private final int[] anIntArray965 = { 0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff }; private IndexedImage titleBoxIndexedImage; private IndexedImage titleButtonIndexedImage; private final int[] anIntArray968; @@ -14883,14 +14103,11 @@ public Client() { private int varCinematicCamRotationSpeedPromille; private IsaacCipher encryption; private Sprite multiOverlay; - public static final int[][] PLAYER_BODY_RECOLOURS = { - {6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193}, - {8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, - 16578, 35003, 25239}, - {25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, - 4783, 1341, 16578, 35003}, - {4626, 11146, 6439, 12, 4758, 10270}, - {4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574}}; + public static final int[][] PLAYER_BODY_RECOLOURS = { + { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193 }, + { 8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239 }, + { 25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003 }, + { 4626, 11146, 6439, 12, 4758, 10270 }, { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } }; private String amountOrNameInput; private static int anInt1005; private int daysSinceLastLogin; @@ -14945,8 +14162,8 @@ public Client() { private int mouseInvInterfaceIndex; private int lastActiveInvInterface; public ResourceProvider resourceProvider; - private int regionX; - private int regionY; + private int regionX; + private int regionY; private int anInt1071; private int[] minimapHintX; private int[] minimapHintY; @@ -15002,8 +14219,8 @@ public Client() { private final String[] playerOptions; private final boolean[] playerOptionsHighPriority; private final int[][][] localRegions; - public static final int[] tabInterfaceIDs = - {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; + public static final int[] tabInterfaceIDs = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1 }; private int cameraY; public int anInt1132; private int menuActionRow; @@ -15026,9 +14243,8 @@ public Client() { private boolean canMute; private boolean constructedViewport; private boolean oriented; - public static int tick; - private static final String validUserPassChars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| "; + public static int tick; + private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| "; private static ProducingGraphicsBuffer tabImageProducer; private ProducingGraphicsBuffer minimapImageProducer; private static ProducingGraphicsBuffer gameScreenImageProducer; @@ -15043,8 +14259,7 @@ public Client() { private boolean showClanOptions; private static int anInt1175; private boolean genericLoadingError; - private final int[] objectGroups = - {0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3}; + private final int[] objectGroups = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3 }; private int reportAbuseInterfaceID; private Deque spawns; private static int[] anIntArray1180; @@ -15067,8 +14282,8 @@ public Client() { private Sprite flameLeftSprite; private Sprite flameRightSprite; private final int[] quakeAmplitudes; - public static final int[] anIntArray1204 = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, - 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486}; + public static final int[] anIntArray1204 = { 9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, + 5027, 1457, 16565, 34991, 25486 }; private static boolean flagged; private final int[] tracks; private int minimapRotation; @@ -15178,6 +14393,7 @@ public void resetAllImageProducers() { welcomeScreenRaised = true; } + @Override public void mouseWheelDragged(int i, int j) { if (!mouseWheelDown) { return; @@ -15242,7 +14458,7 @@ private void sendCommandPacket(String cmd) { consoleMessages[j] = null; } } - switch(cmd) { + switch (cmd) { case "int": String[] split = inputString.split(" "); try { @@ -15260,8 +14476,8 @@ private void sendCommandPacket(String cmd) { Configuration.enableIds = !Configuration.enableIds; break; case "childids": - for(int i = 0; i < 25000; i++) { - sendString(""+i, i); + for (int i = 0; i < 25000; i++) { + sendString("" + i, i); } break; case "finterface": @@ -15281,8 +14497,7 @@ private void sendCommandPacket(String cmd) { break; case "10xhp": Configuration.tenXHp = !Configuration.tenXHp; - loadAllOrbs(frameMode == ScreenMode.FIXED ? 0 - : frameWidth - 217); + loadAllOrbs(frameMode == ScreenMode.FIXED ? 0 : frameWidth - 217); break; case "hp": Configuration.hpAboveHeads = !Configuration.hpAboveHeads; @@ -15300,14 +14515,11 @@ private void sendCommandPacket(String cmd) { resourceProvider.writeChecksumList(3); break; case "rint": - GameFont gameFont = new GameFont(true, "q8_full", - titleArchive); - GameFont fonts[] = - {smallText, regularText, boldText, gameFont}; - FileArchive interfaces = createArchive(3, "interface", - "interface", Jaggrab.CRCs[Jaggrab.INTERFACE_CRC], 35); - FileArchive graphics = createArchive(4, "2d graphics", - "media", Jaggrab.CRCs[Jaggrab.MEDIA_CRC], 40); + GameFont gameFont = new GameFont(true, "q8_full", titleArchive); + GameFont fonts[] = { smallText, regularText, boldText, gameFont }; + FileArchive interfaces = createArchive(3, "interface", "interface", Jaggrab.CRCs[Jaggrab.INTERFACE_CRC], + 35); + FileArchive graphics = createArchive(4, "2d graphics", "media", Jaggrab.CRCs[Jaggrab.MEDIA_CRC], 40); Widget.load(interfaces, fonts, graphics); break; case "fog": @@ -15344,10 +14556,9 @@ private void sendCommandPacket(String cmd) { break; case "noclip": for (int plane = 0; plane < 4; plane++) { - for (int x = 1; x < 103; x++) { - for (int y = 1; y < 103; y++) { - collisionMaps[plane].adjacencies[x][y] = - 0; + for (int x = 1; x < 103; x++) { + for (int y = 1; y < 103; y++) { + collisionMaps[plane].adjacencies[x][y] = 0; } } } @@ -15364,7 +14575,7 @@ private void sendCommandPacket(String cmd) { int i = 0; for (int j = 0; j < 99; j++) { int l = j + 1; - int i1 = (int) ((double) l + 300D * Math.pow(2D, (double) l / 7D)); + int i1 = (int) (l + 300D * Math.pow(2D, l / 7D)); i += i1; SKILL_EXPERIENCE[j] = i / 4; } diff --git a/Elvarg - Client/src/com/runescape/Configuration.java b/Elvarg - Client/src/com/runescape/Configuration.java index d201e28..fe3f8e5 100644 --- a/Elvarg - Client/src/com/runescape/Configuration.java +++ b/Elvarg - Client/src/com/runescape/Configuration.java @@ -8,9 +8,9 @@ * @author Seven */ public final class Configuration { - + private Configuration() { - + } /** @@ -21,7 +21,7 @@ private Configuration() { /** * The address of the server that the client will be connecting to */ - public static String server_address = "localhost"; // 149.56.164.17 + public static String server_address = "localhost"; public static final String CACHE_DIRECTORY = System.getProperty("user.home") + File.separator + "Cache/"; @@ -29,8 +29,8 @@ private Configuration() { * The port of the server that the client will be connecting to */ public static int server_port = 43595; - - //JAGGRAB + + // JAGGRAB public static final int JAGGRAB_PORT = 43596; public static final int FILE_SERVER_PORT = 43597; @@ -44,12 +44,12 @@ private Configuration() { /** * The url that the users will get redirected to after clicking "New User" */ - public static final String REGISTER_ACCOUNT = "www.google.com"; + public static final String REGISTER_ACCOUNT = "http://www.exigence.org/"; /** * A string which indicates the Client's name. */ - public static final String CLIENT_NAME = "Elvarg"; + public static final String CLIENT_NAME = "Exigence"; /** * Dumps map region images when new regions are loaded. @@ -155,7 +155,7 @@ private Configuration() { * Enables the HUD to display 10 X the amount of hitpoints */ public static boolean tenXHp = false; - + /** * Should it be snow in the game? White floor. */ diff --git a/Elvarg - Client/src/com/runescape/GameApplet.java b/Elvarg - Client/src/com/runescape/GameApplet.java index 40e1751..8497b80 100644 --- a/Elvarg - Client/src/com/runescape/GameApplet.java +++ b/Elvarg - Client/src/com/runescape/GameApplet.java @@ -1,16 +1,30 @@ package com.runescape; import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import com.runescape.Client.ScreenMode; import com.runescape.cache.graphics.Widget; import com.runescape.draw.ProducingGraphicsBuffer; -public class GameApplet extends Applet implements Runnable, MouseListener, - MouseMotionListener, MouseWheelListener, KeyListener, FocusListener, - WindowListener { +public class GameApplet extends Applet implements Runnable, MouseListener, MouseMotionListener, MouseWheelListener, + KeyListener, FocusListener, WindowListener { private static final long serialVersionUID = 1L; @@ -48,8 +62,7 @@ public class GameApplet extends Applet implements Runnable, MouseListener, protected int rotationGliding; public boolean resized; - public void refreshFrameSize(boolean undecorated, int width, int height, - boolean resizable, boolean full) { + public void refreshFrameSize(boolean undecorated, int width, int height, boolean resizable, boolean full) { boolean createdByApplet = (isApplet && !full); myWidth = width; myHeight = height; @@ -57,8 +70,7 @@ public void refreshFrameSize(boolean undecorated, int width, int height, gameFrame.dispose(); } if (!createdByApplet) { - gameFrame = new GameFrame(this, width, height, resizable, - undecorated); + gameFrame = new GameFrame(this, width, height, resizable, undecorated); gameFrame.addWindowListener(this); } graphics = (createdByApplet ? this : gameFrame).getGraphics(); @@ -79,8 +91,7 @@ final void createClientFrame(int w, int h) { isApplet = false; myWidth = w; myHeight = h; - gameFrame = new GameFrame(this, myWidth, myHeight, - Client.frameMode == Client.ScreenMode.RESIZABLE, + gameFrame = new GameFrame(this, myWidth, myHeight, Client.frameMode == Client.ScreenMode.RESIZABLE, Client.frameMode == Client.ScreenMode.FULLSCREEN); gameFrame.setFocusTraversalKeysEnabled(false); graphics = getGameComponent().getGraphics(); @@ -97,6 +108,7 @@ final void initClientFrame(int w, int h) { startRunnable(this, 1); } + @Override public void run() { getGameComponent().addMouseListener(this); getGameComponent().addMouseMotionListener(this); @@ -136,14 +148,14 @@ public void run() { j = k1; k = i2; } else if (l2 > aLongArray7[i]) { - j = (int) ((long) (2560 * delayTime) / (l2 - aLongArray7[i])); + j = (int) (2560 * delayTime / (l2 - aLongArray7[i])); } if (j < 25) { j = 25; } if (j > 256) { j = 256; - k = (int) ((long) delayTime - (l2 - aLongArray7[i]) / 10L); + k = (int) (delayTime - (l2 - aLongArray7[i]) / 10L); } if (k > delayTime) { k = delayTime; @@ -181,23 +193,19 @@ public void run() { } processDrawing(); if (shouldDebug) { - System.out.println((new StringBuilder()).append("ntime:") - .append(l2).toString()); + System.out.println((new StringBuilder()).append("ntime:").append(l2).toString()); for (int k2 = 0; k2 < 10; k2++) { int i3 = ((i - k2 - 1) + 20) % 10; - System.out.println((new StringBuilder()).append("otim") - .append(i3).append(":").append(aLongArray7[i3]) - .toString()); + System.out.println((new StringBuilder()).append("otim").append(i3).append(":") + .append(aLongArray7[i3]).toString()); } - System.out.println((new StringBuilder()).append("fps:") - .append(fps).append(" ratio:").append(j) + System.out.println((new StringBuilder()).append("fps:").append(fps).append(" ratio:").append(j) .append(" count:").append(l).toString()); - System.out.println((new StringBuilder()).append("del:") - .append(k).append(" deltime:").append(delayTime) + System.out.println((new StringBuilder()).append("del:").append(k).append(" deltime:").append(delayTime) .append(" mindel:").append(minDelay).toString()); - System.out.println((new StringBuilder()).append("intex:") - .append(i1).append(" opos:").append(i).toString()); + System.out.println( + (new StringBuilder()).append("intex:").append(i1).append(" opos:").append(i).toString()); shouldDebug = false; i1 = 0; } @@ -226,18 +234,21 @@ final void method4(int i) { delayTime = 1000 / i; } + @Override public final void start() { if (anInt4 >= 0) { anInt4 = 0; } } + @Override public final void stop() { if (anInt4 >= 0) { anInt4 = 4000 / delayTime; } } + @Override public final void destroy() { anInt4 = -1; try { @@ -249,6 +260,7 @@ public final void destroy() { } } + @Override public final void update(Graphics g) { if (graphics == null) { graphics = g; @@ -257,6 +269,7 @@ public final void update(Graphics g) { raiseWelcomeScreen(); } + @Override public final void paint(Graphics g) { if (graphics == null) { graphics = g; @@ -265,11 +278,11 @@ public final void paint(Graphics g) { raiseWelcomeScreen(); } + @Override public void mouseWheelMoved(MouseWheelEvent event) { int rotation = event.getWheelRotation(); handleInterfaceScrolling(event); - if (mouseX > 0 && mouseX < 512 && mouseY > Client.frameHeight - 165 - && mouseY < Client.frameHeight - 25) { + if (mouseX > 0 && mouseX < 512 && mouseY > Client.frameHeight - 165 && mouseY < Client.frameHeight - 25) { int scrollPos = Client.anInt1089; scrollPos -= rotation * 30; if (scrollPos < 0) @@ -280,43 +293,40 @@ public void mouseWheelMoved(MouseWheelEvent event) { Client.anInt1089 = scrollPos; Client.updateChatbox = true; } - } else if(Client.loggedIn) { - + } else if (Client.loggedIn) { + /** ZOOMING **/ boolean zoom = Client.frameMode == ScreenMode.FIXED ? (mouseX < 512) : (mouseX < Client.frameWidth - 200); - if(zoom && Client.openInterfaceId == -1) { + if (zoom && Client.openInterfaceId == -1) { Client.cameraZoom += rotation * 35; int max_zoom_1 = (Client.frameMode == ScreenMode.FIXED ? -150 : -300); - if(Client.cameraZoom < max_zoom_1) { + if (Client.cameraZoom < max_zoom_1) { Client.cameraZoom = max_zoom_1; } - - if(Client.cameraZoom > 1200) { + + if (Client.cameraZoom > 1200) { Client.cameraZoom = 1200; } - + int setting = 0; - - if(Client.cameraZoom > 1000) { + + if (Client.cameraZoom > 1000) { setting = 4; - } else if(Client.cameraZoom > 800) { + } else if (Client.cameraZoom > 800) { setting = 3; - } else if(Client.cameraZoom > 600) { + } else if (Client.cameraZoom > 600) { setting = 2; - } else if(Client.cameraZoom > 400) { + } else if (Client.cameraZoom > 400) { setting = 1; - } - + } + Client.instance.settings[168] = setting; } - - - + Client.updateChatbox = true; } - - + } public void handleInterfaceScrolling(MouseWheelEvent event) { @@ -332,12 +342,10 @@ public void handleInterfaceScrolling(MouseWheelEvent event) { if (tabInterfaceID != -1) { Widget tab = Widget.interfaceCache[tabInterfaceID]; offsetX = Client.frameMode == Client.ScreenMode.FIXED ? Client.frameWidth - 218 - : (Client.frameMode == Client.ScreenMode.FIXED ? 28 - : Client.frameWidth - 197); + : (Client.frameMode == Client.ScreenMode.FIXED ? 28 : Client.frameWidth - 197); offsetY = Client.frameMode == Client.ScreenMode.FIXED ? Client.frameHeight - 298 : (Client.frameMode == Client.ScreenMode.FIXED ? 37 - : Client.frameHeight - - (Client.frameWidth >= 1000 ? 37 : 74) - 267); + : Client.frameHeight - (Client.frameWidth >= 1000 ? 37 : 74) - 267); for (int index = 0; index < tab.children.length; index++) { if (Widget.interfaceCache[tab.children[index]].scrollMax > 0) { childID = index; @@ -348,18 +356,15 @@ public void handleInterfaceScrolling(MouseWheelEvent event) { break; } } - if (mouseX > offsetX + positionX && mouseY > offsetY + positionY - && mouseX < offsetX + positionX + width + if (mouseX > offsetX + positionX && mouseY > offsetY + positionY && mouseX < offsetX + positionX + width && mouseY < offsetY + positionY + height) { Widget.interfaceCache[tab.children[childID]].scrollPosition += rotation * 30; } } if (Client.openInterfaceId != -1) { Widget rsi = Widget.interfaceCache[Client.openInterfaceId]; - offsetX = Client.frameMode == Client.ScreenMode.FIXED ? 4 - : (Client.frameWidth / 2) - 356; - offsetY = Client.frameMode == Client.ScreenMode.FIXED ? 4 - : (Client.frameHeight / 2) - 230; + offsetX = Client.frameMode == Client.ScreenMode.FIXED ? 4 : (Client.frameWidth / 2) - 356; + offsetY = Client.frameMode == Client.ScreenMode.FIXED ? 4 : (Client.frameHeight / 2) - 230; for (int index = 0; index < rsi.children.length; index++) { if (Widget.interfaceCache[rsi.children[index]].scrollMax > 0) { childID = index; @@ -370,8 +375,7 @@ public void handleInterfaceScrolling(MouseWheelEvent event) { break; } } - if (mouseX > offsetX + positionX && mouseY > offsetY + positionY - && mouseX < offsetX + positionX + width + if (mouseX > offsetX + positionX && mouseY > offsetY + positionY && mouseX < offsetX + positionX + width && mouseY < offsetY + positionY + height) { Widget.interfaceCache[rsi.children[childID]].scrollPosition += rotation * 30; } @@ -388,6 +392,7 @@ public void handleInterfaceScrolling(MouseWheelEvent event) { public int releasedY; public boolean mouseWheelDown; + @Override public final void mousePressed(MouseEvent e) { int x = e.getX(); int y = e.getY(); @@ -418,6 +423,7 @@ public final void mousePressed(MouseEvent e) { } } + @Override public final void mouseReleased(MouseEvent e) { int x = e.getX(); int y = e.getY(); @@ -434,12 +440,15 @@ public final void mouseReleased(MouseEvent e) { mouseWheelDown = false; } + @Override public final void mouseClicked(MouseEvent mouseevent) { } + @Override public final void mouseEntered(MouseEvent mouseevent) { } + @Override public final void mouseExited(MouseEvent mouseevent) { idleTime = 0; mouseX = -1; @@ -449,6 +458,7 @@ public final void mouseExited(MouseEvent mouseevent) { public int mouseWheelX; public int mouseWheelY; + @Override public final void mouseDragged(MouseEvent e) { int x = e.getX(); int y = e.getY(); @@ -475,6 +485,7 @@ void mouseWheelDragged(int param1, int param2) { } + @Override public final void mouseMoved(MouseEvent mouseevent) { int x = mouseevent.getX(); int y = mouseevent.getY(); @@ -489,6 +500,7 @@ public final void mouseMoved(MouseEvent mouseevent) { clickType = MOVE; } + @Override public final void keyPressed(KeyEvent keyevent) { idleTime = 0; int i = keyevent.getKeyCode(); @@ -546,6 +558,7 @@ public final void keyPressed(KeyEvent keyevent) { } } + @Override public final void keyReleased(KeyEvent keyevent) { idleTime = 0; int i = keyevent.getKeyCode(); @@ -574,6 +587,7 @@ public final void keyReleased(KeyEvent keyevent) { keyArray[c] = 0; } + @Override public final void keyTyped(KeyEvent keyevent) { } @@ -590,12 +604,14 @@ final int readChar(int dummy) { return k; } + @Override public final void focusGained(FocusEvent focusevent) { awtFocus = true; shouldClearScreen = true; raiseWelcomeScreen(); } + @Override public final void focusLost(FocusEvent focusevent) { awtFocus = false; for (int i = 0; i < 128; i++) { @@ -604,26 +620,33 @@ public final void focusLost(FocusEvent focusevent) { } + @Override public final void windowActivated(WindowEvent windowevent) { } + @Override public final void windowClosed(WindowEvent windowevent) { } + @Override public final void windowClosing(WindowEvent windowevent) { destroy(); } + @Override public final void windowDeactivated(WindowEvent windowevent) { } + @Override public final void windowDeiconified(WindowEvent windowevent) { } + @Override public final void windowIconified(WindowEvent windowevent) { } + @Override public final void windowOpened(WindowEvent windowevent) { } @@ -683,15 +706,11 @@ void drawLoadingText(int percentage, String loadingText) { graphics.drawRect(Client.frameWidth / 2 - 152, y, 304, 34); graphics.fillRect(Client.frameWidth / 2 - 150, y + 2, percentage * 3, 30); graphics.setColor(Color.black); - graphics.fillRect((Client.frameWidth / 2 - 150) + percentage * 3, y + 2, - 300 - percentage * 3, 30); + graphics.fillRect((Client.frameWidth / 2 - 150) + percentage * 3, y + 2, 300 - percentage * 3, 30); graphics.setFont(font); graphics.setColor(Color.white); - graphics.drawString(loadingText, - (Client.frameWidth - fontmetrics.stringWidth(loadingText)) / 2, - y + 22); - graphics.drawString("", - (Client.frameWidth - fontmetrics1.stringWidth("")) / 2, y - 8); + graphics.drawString(loadingText, (Client.frameWidth - fontmetrics.stringWidth(loadingText)) / 2, y + 22); + graphics.drawString("", (Client.frameWidth - fontmetrics1.stringWidth("")) / 2, y - 8); } GameApplet() { diff --git a/Elvarg - Client/src/com/runescape/GameFrame.java b/Elvarg - Client/src/com/runescape/GameFrame.java index 00bfb3f..1abb654 100644 --- a/Elvarg - Client/src/com/runescape/GameFrame.java +++ b/Elvarg - Client/src/com/runescape/GameFrame.java @@ -1,5 +1,11 @@ package com.runescape; -import java.awt.*; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Toolkit; public final class GameFrame extends Frame { @@ -13,10 +19,10 @@ public final class GameFrame extends Frame { public GameFrame(GameApplet applet, int width, int height, boolean resizable, boolean fullscreen) { this.applet = applet; - setTitle(Configuration.CLIENT_NAME); + setTitle(Configuration.CLIENT_NAME + " - Game Launcher"); setResizable(resizable); setUndecorated(fullscreen); - setVisible(true); + setVisible(true); insets = getInsets(); if (resizable) { setMinimumSize(new Dimension(766 + insets.left + insets.right, 536 + insets.top + insets.bottom)); @@ -28,6 +34,7 @@ public GameFrame(GameApplet applet, int width, int height, boolean resizable, bo toFront(); } + @Override public Graphics getGraphics() { final Graphics graphics = super.getGraphics(); Insets insets = this.getInsets(); @@ -46,10 +53,12 @@ public int getFrameHeight() { return getHeight() - (insets.top + insets.bottom); } + @Override public void update(Graphics graphics) { applet.update(graphics); } + @Override public void paint(Graphics graphics) { applet.paint(graphics); } diff --git a/Elvarg - Client/src/com/runescape/cache/FileArchive.java b/Elvarg - Client/src/com/runescape/cache/FileArchive.java index 6082640..49c4c60 100644 --- a/Elvarg - Client/src/com/runescape/cache/FileArchive.java +++ b/Elvarg - Client/src/com/runescape/cache/FileArchive.java @@ -4,53 +4,54 @@ import com.runescape.io.Buffer; public final class FileArchive { - + /** * The buffer containing the decompressed data in this Archive. */ private final byte[] buffer; - + /** * The amount of entries in this Archive. */ private final int entries; - + /** - * The identifiers (i.e. hashed names) of each of the entries in this Archive. + * The identifiers (i.e. hashed names) of each of the entries in this + * Archive. */ private final int[] identifiers; - + /** * The raw (i.e. decompressed) sizes of each of the entries in this Archive. */ private final int[] extractedSizes; - + /** * The compressed sizes of each of the entries in this Archive. */ private final int[] sizes; private final int[] indices; - + /** - * Whether or not this Archive was compressed as a whole: if false, decompression will be performed on each of the - * individual entries. + * Whether or not this Archive was compressed as a whole: if false, + * decompression will be performed on each of the individual entries. */ private final boolean extracted; public FileArchive(byte data[]) { Buffer buffer = new Buffer(data); - - int decompressedLength = buffer.readTriByte(); - int compressedLength = buffer.readTriByte(); - + + int decompressedLength = buffer.readTriByte(); + int compressedLength = buffer.readTriByte(); + if (compressedLength != decompressedLength) { - + byte output[] = new byte[decompressedLength]; - + BZip2Decompressor.decompress(output, decompressedLength, data, compressedLength, 6); - + this.buffer = output; - + buffer = new Buffer(this.buffer); extracted = true; } else { @@ -71,7 +72,7 @@ public FileArchive(byte data[]) { offset += sizes[file]; } } - + public int getHash(String name) { int hash = 0; name = name.toUpperCase(); @@ -86,7 +87,7 @@ public int getHash(String name) { return -1; } - public byte[] readFile(String name) { + public byte[] readFile(String name) { byte output[] = null; int hash = 0; name = name.toUpperCase(); @@ -100,16 +101,14 @@ public byte[] readFile(String name) { output = new byte[extractedSizes[file]]; } if (!extracted) { - BZip2Decompressor.decompress(output, extractedSizes[file], this.buffer, - sizes[file], indices[file]); + BZip2Decompressor.decompress(output, extractedSizes[file], this.buffer, sizes[file], indices[file]); } else { - System.arraycopy(this.buffer, indices[file], output, - 0, extractedSizes[file]); + System.arraycopy(this.buffer, indices[file], output, 0, extractedSizes[file]); } return output; } } - + return null; } diff --git a/Elvarg - Client/src/com/runescape/cache/FileStore.java b/Elvarg - Client/src/com/runescape/cache/FileStore.java index 51aee6e..7c9bc3c 100644 --- a/Elvarg - Client/src/com/runescape/cache/FileStore.java +++ b/Elvarg - Client/src/com/runescape/cache/FileStore.java @@ -1,6 +1,7 @@ package com.runescape.cache; -import java.io.*; +import java.io.IOException; +import java.io.RandomAccessFile; public final class FileStore { @@ -27,7 +28,7 @@ public int getIndex() { } } - + private static final byte[] buffer = new byte[520]; private final RandomAccessFile dataFile; private final RandomAccessFile indexFile; @@ -54,7 +55,7 @@ public synchronized byte[] decompress(int id) { int size = ((buffer[0] & 0xff) << 16) + ((buffer[1] & 0xff) << 8) + (buffer[2] & 0xff); int sector = ((buffer[3] & 0xff) << 16) + ((buffer[4] & 0xff) << 8) + (buffer[5] & 0xff); - if (sector <= 0 || (long) sector > dataFile.length() / 520L) { + if (sector <= 0 || sector > dataFile.length() / 520L) { return null; } @@ -92,7 +93,7 @@ public synchronized byte[] decompress(int id) { return null; } - if (nextSector < 0 || (long) nextSector > dataFile.length() / 520L) { + if (nextSector < 0 || nextSector > dataFile.length() / 520L) { return null; } @@ -130,7 +131,7 @@ private synchronized boolean writeFile(byte bytes[], int position, int length, b } sector = ((buffer[3] & 0xff) << 16) + ((buffer[4] & 0xff) << 8) + (buffer[5] & 0xff); - if (sector <= 0 || (long) sector > dataFile.length() / 520L) { + if (sector <= 0 || sector > dataFile.length() / 520L) { return false; } @@ -177,7 +178,7 @@ private synchronized boolean writeFile(byte bytes[], int position, int length, b return false; } - if (nextSector < 0 || (long) nextSector > dataFile.length() / 520L) { + if (nextSector < 0 || nextSector > dataFile.length() / 520L) { return false; } } @@ -228,9 +229,9 @@ private synchronized boolean writeFile(byte bytes[], int position, int length, b } } - private synchronized void seek(RandomAccessFile file, int position) throws IOException { + private synchronized void seek(RandomAccessFile file, int position) throws IOException { try { - file.seek(position); + file.seek(position); } catch (Exception e) { e.printStackTrace(); } @@ -238,6 +239,7 @@ private synchronized void seek(RandomAccessFile file, int position) throws IOExc /** * Returns the number of files in the cache index. + * * @return */ public long getFileCount() { diff --git a/Elvarg - Client/src/com/runescape/cache/anim/Animation.java b/Elvarg - Client/src/com/runescape/cache/anim/Animation.java index 193924b..cff98ec 100644 --- a/Elvarg - Client/src/com/runescape/cache/anim/Animation.java +++ b/Elvarg - Client/src/com/runescape/cache/anim/Animation.java @@ -1,43 +1,41 @@ package com.runescape.cache.anim; + import com.runescape.cache.FileArchive; import com.runescape.io.Buffer; public final class Animation { - public static void init(FileArchive streamLoader) - { + public static void init(FileArchive streamLoader) { Buffer stream = new Buffer(streamLoader.readFile("seq.dat")); int length = stream.readUShort(); - if(animations == null) + if (animations == null) animations = new Animation[length + 5000]; - for(int j = 0; j < length; j++) { - if(animations[j] == null) + for (int j = 0; j < length; j++) { + if (animations[j] == null) animations[j] = new Animation(); animations[j].readValues(stream); } - - System.out.println("Loaded: "+length+" Animations"); + + System.out.println("Loaded: " + length + " Animations"); } public int duration(int i) { int j = durations[i]; - if(j == 0) - { + if (j == 0) { Frame frame = Frame.method531(primaryFrames[i]); - if(frame != null) { + if (frame != null) { j = durations[i] = frame.duration; } } - if(j == 0) + if (j == 0) j = 1; return j; } private void readValues(Buffer stream) { int i; - while ((i = stream.readUnsignedByte()) != 0){ - + while ((i = stream.readUnsignedByte()) != 0) { if (i == 1) { frameCount = stream.readUShort(); @@ -49,7 +47,6 @@ private void readValues(Buffer stream) { secondaryFrames[j] = -1; } - for (int j = 0; j < frameCount; j++) durations[j] = stream.readUnsignedByte(); @@ -109,12 +106,12 @@ private Animation() { loopOffset = -1; stretches = false; forcedPriority = 5; - playerOffhand = -1; //Removes shield - playerMainhand = -1; //Removes weapon + playerOffhand = -1; // Removes shield + playerMainhand = -1; // Removes weapon maximumLoops = 99; - animatingPrecedence = -1; //Stops character from moving + animatingPrecedence = -1; // Stops character from moving priority = -1; - replayMode = 1; + replayMode = 1; } public static Animation animations[]; diff --git a/Elvarg - Client/src/com/runescape/cache/anim/Frame.java b/Elvarg - Client/src/com/runescape/cache/anim/Frame.java index f42d1c2..26df637 100644 --- a/Elvarg - Client/src/com/runescape/cache/anim/Frame.java +++ b/Elvarg - Client/src/com/runescape/cache/anim/Frame.java @@ -1,4 +1,5 @@ package com.runescape.cache.anim; + import com.runescape.Client; import com.runescape.io.Buffer; @@ -10,14 +11,16 @@ public static void load(int file, byte[] array) { try { final Buffer ay = new Buffer(array); final FrameBase b2 = new FrameBase(ay); - final int n = ay.readUShort();; + final int n = ay.readUShort(); + ; animationlist[file] = new Frame[n * 3]; final int[] array2 = new int[500]; final int[] array3 = new int[500]; final int[] array4 = new int[500]; final int[] array5 = new int[500]; for (int j = 0; j < n; ++j) { - final int k = ay.readUShort();; + final int k = ay.readUShort(); + ; final Frame[] array6 = animationlist[file]; final int n2 = k; final Frame q = new Frame(); @@ -48,20 +51,17 @@ public static void load(int file, byte[] array) { } if ((f2 & 0x1) != 0x0) { array3[c2] = ay.readShort2(); - } - else { + } else { array3[c2] = n4; } if ((f2 & 0x2) != 0x0) { array4[c2] = ay.readShort2(); - } - else { + } else { array4[c2] = n4; } if ((f2 & 0x4) != 0x0) { array5[c2] = ay.readShort2(); - } - else { + } else { array5[c2] = n4; } n3 = l; @@ -80,26 +80,25 @@ public static void load(int file, byte[] array) { q2.transformZ[l] = array5[l]; } } - } catch (Exception ex) { + } catch (Exception ex) { - //ex.printStackTrace(); + // ex.printStackTrace(); } } public static Frame method531(int frame) { try { - + int file = frame >> 16; int k = frame & 0xffff; - + if (animationlist[file].length == 0) { Client.instance.resourceProvider.provide(1, file); return null; } - + return animationlist[file][k]; - } - catch (Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); return null; } diff --git a/Elvarg - Client/src/com/runescape/cache/anim/FrameBase.java b/Elvarg - Client/src/com/runescape/cache/anim/FrameBase.java index 5fbb87e..5644186 100644 --- a/Elvarg - Client/src/com/runescape/cache/anim/FrameBase.java +++ b/Elvarg - Client/src/com/runescape/cache/anim/FrameBase.java @@ -1,30 +1,31 @@ package com.runescape.cache.anim; + import com.runescape.io.Buffer; public final class FrameBase { - - /** - * The type of each transformation. - */ - public final int[] transformationType; - - public final int[][] skinList; - - public FrameBase(Buffer stream) { + + /** + * The type of each transformation. + */ + public final int[] transformationType; + + public final int[][] skinList; + + public FrameBase(Buffer stream) { int count = stream.readUShort(); - - transformationType = new int[count]; + + transformationType = new int[count]; skinList = new int[count][]; - - for (int index = 0; index < count; index++) { + + for (int index = 0; index < count; index++) { transformationType[index] = stream.readUShort(); } - for (int label = 0; label < count; label++) { + for (int label = 0; label < count; label++) { skinList[label] = new int[stream.readUShort()]; } - for (int label = 0; label < count; label++) { + for (int label = 0; label < count; label++) { for (int index = 0; index < skinList[label].length; index++) { skinList[label][index] = stream.readUShort(); } diff --git a/Elvarg - Client/src/com/runescape/cache/anim/Graphic.java b/Elvarg - Client/src/com/runescape/cache/anim/Graphic.java index f11eeb8..6ba0b27 100644 --- a/Elvarg - Client/src/com/runescape/cache/anim/Graphic.java +++ b/Elvarg - Client/src/com/runescape/cache/anim/Graphic.java @@ -1,4 +1,5 @@ package com.runescape.cache.anim; + import com.runescape.cache.FileArchive; import com.runescape.collection.ReferenceCache; import com.runescape.entity.model.Model; @@ -10,15 +11,15 @@ public static void init(FileArchive streamLoader) { Buffer stream = new Buffer(streamLoader.readFile("spotanim.dat")); int length = stream.readUShort(); if (cache == null) - cache = new Graphic[length + 1]; + cache = new Graphic[length + 1]; for (int index = 0; index < length; index++) { if (cache[index] == null) cache[index] = new Graphic(); cache[index].anInt404 = index; cache[index].readValues(stream); } - - System.out.println("Loaded: "+length+" Graphics"); + + System.out.println("Loaded: " + length + " Graphics"); } public void readValues(Buffer stream) { @@ -49,8 +50,7 @@ else if (opcode == 40) { modifiedModelColours[k] = stream.readUShort(); } } else - System.out.println("Error unrecognised spotanim config code: " - + opcode); + System.out.println("Error unrecognised spotanim config code: " + opcode); } while (true); } diff --git a/Elvarg - Client/src/com/runescape/cache/bzip/BZip2DecompressionState.java b/Elvarg - Client/src/com/runescape/cache/bzip/BZip2DecompressionState.java index e7450b8..2bbdeda 100644 --- a/Elvarg - Client/src/com/runescape/cache/bzip/BZip2DecompressionState.java +++ b/Elvarg - Client/src/com/runescape/cache/bzip/BZip2DecompressionState.java @@ -1,7 +1,7 @@ package com.runescape.cache.bzip; final class BZip2DecompressionState { - + byte compressed[]; int nextIn; int decompressedLength; diff --git a/Elvarg - Client/src/com/runescape/cache/bzip/BZip2Decompressor.java b/Elvarg - Client/src/com/runescape/cache/bzip/BZip2Decompressor.java index 1a32e76..77e9a8e 100644 --- a/Elvarg - Client/src/com/runescape/cache/bzip/BZip2Decompressor.java +++ b/Elvarg - Client/src/com/runescape/cache/bzip/BZip2Decompressor.java @@ -158,7 +158,7 @@ private static void decompress(BZip2DecompressionState state) { uc = getUnsignedChar(state); uc = getUnsignedChar(state); uc = getBit(state); - state.aBoolean575 = uc != 0; + state.aBoolean575 = uc != 0; state.randomised = 0; uc = getUnsignedChar(state); state.randomised = state.randomised << 8 | uc & 0xff; @@ -191,7 +191,8 @@ private static void decompress(BZip2DecompressionState state) { */ int huffmanTableCount = getBits(3, state); /* - * number of times that the Huffman tables are swapped (each 50 bytes) + * number of times that the Huffman tables are swapped (each 50 + * bytes) */ int swapCount = getBits(15, state); for (int i1 = 0; i1 < swapCount; i1++) { @@ -247,7 +248,8 @@ private static void decompress(BZip2DecompressionState state) { byte8 = state.len[l3][l1]; } - createDecodeTables(state.limit[l3], state.base[l3], state.perm[l3], state.len[l3], byte8, i, alphabetSize); + createDecodeTables(state.limit[l3], state.base[l3], state.perm[l3], state.len[l3], byte8, i, + alphabetSize); state.minLens[l3] = byte8; } @@ -460,7 +462,8 @@ private static void makeMaps(BZip2DecompressionState state) { } - private static void createDecodeTables(int limit[], int base[], int perm[], byte length[], int i, int maxLength, int alphabetSize) { + private static void createDecodeTables(int limit[], int base[], int perm[], byte length[], int i, int maxLength, + int alphabetSize) { int pp = 0; for (int i1 = i; i1 <= maxLength; i1++) { for (int l2 = 0; l2 < alphabetSize; l2++) { diff --git a/Elvarg - Client/src/com/runescape/cache/config/VariableBits.java b/Elvarg - Client/src/com/runescape/cache/config/VariableBits.java index e3ea2f6..0839c13 100644 --- a/Elvarg - Client/src/com/runescape/cache/config/VariableBits.java +++ b/Elvarg - Client/src/com/runescape/cache/config/VariableBits.java @@ -4,8 +4,8 @@ import com.runescape.io.Buffer; public final class VariableBits { - - public static VariableBits varbits[]; + + public static VariableBits varbits[]; public int setting; public int low; public int high; @@ -14,29 +14,29 @@ public final class VariableBits { public static void init(FileArchive streamLoader) { Buffer stream = new Buffer(streamLoader.readFile("varbit.dat")); int size = stream.readUShort(); - + if (varbits == null) { varbits = new VariableBits[size]; } - + for (int index = 0; index < size; index++) { - + if (varbits[index] == null) { varbits[index] = new VariableBits(); } - + varbits[index].decode(stream); - + if (varbits[index].aBoolean651) { VariablePlayer.variables[varbits[index].setting].aBoolean713 = true; } - + } if (stream.currentPosition != stream.payload.length) { System.out.println("varbit load mismatch"); } - + } private void decode(Buffer stream) { @@ -60,5 +60,5 @@ public int getLow() { public int getHigh() { return high; } - + } diff --git a/Elvarg - Client/src/com/runescape/cache/config/VariablePlayer.java b/Elvarg - Client/src/com/runescape/cache/config/VariablePlayer.java index a65b192..62af282 100644 --- a/Elvarg - Client/src/com/runescape/cache/config/VariablePlayer.java +++ b/Elvarg - Client/src/com/runescape/cache/config/VariablePlayer.java @@ -4,16 +4,17 @@ import com.runescape.io.Buffer; /** - * Varps are used for inteface configuration ids and their functions, out of the current 725 config ids, only 9 or so of them are used. + * Varps are used for inteface configuration ids and their functions, out of the + * current 725 config ids, only 9 or so of them are used. * */ public final class VariablePlayer { - public static VariablePlayer[] variables; + public static VariablePlayer[] variables; private static int currentIndex; - private static int[] configIds; - public int actionId; + private static int[] configIds; + public int actionId; public boolean aBoolean713; private VariablePlayer() { @@ -28,9 +29,8 @@ public static void init(FileArchive archive) { final int actualSize = buffer.readUShort(); /** - * Cache size is 725. - * But instead of setting array sizes to 725, we set it to 1200. - * This leaves space for custom configs. + * Cache size is 725. But instead of setting array sizes to 725, we set + * it to 1200. This leaves space for custom configs. */ int customSize = 1200; @@ -47,7 +47,7 @@ public static void init(FileArchive archive) { variables[index] = new VariablePlayer(); } - if(index < actualSize) { + if (index < actualSize) { variables[index].decode(buffer, index); } } @@ -58,7 +58,7 @@ public static void init(FileArchive archive) { } - private void decode(Buffer buffer, int index) { + private void decode(Buffer buffer, int index) { do { int opcode = buffer.readUnsignedByte(); @@ -71,7 +71,7 @@ private void decode(Buffer buffer, int index) { } else if (opcode == 2) { buffer.readUnsignedByte(); } else if (opcode == 3) { - configIds[currentIndex++] = index; + configIds[currentIndex++] = index; } else if (opcode == 4) { } else if (opcode == 5) { actionId = buffer.readUShort(); @@ -111,6 +111,6 @@ public int getActionId() { public boolean isaBoolean713() { return aBoolean713; - } + } } diff --git a/Elvarg - Client/src/com/runescape/cache/def/FloorDefinition.java b/Elvarg - Client/src/com/runescape/cache/def/FloorDefinition.java index 72bd78f..2672c49 100644 --- a/Elvarg - Client/src/com/runescape/cache/def/FloorDefinition.java +++ b/Elvarg - Client/src/com/runescape/cache/def/FloorDefinition.java @@ -5,172 +5,172 @@ import com.runescape.cache.FileArchive; public class FloorDefinition { - + public static FloorDefinition[] overlays; - public static FloorDefinition[] underlays; + public static FloorDefinition[] underlays; + + public static void init(FileArchive archive) { + ByteBuffer buffer = ByteBuffer.wrap(archive.readFile("flo.dat")); + int underlayAmount = buffer.getShort(); + System.out.println("Underlay Floors Loaded: " + underlayAmount); + underlays = new FloorDefinition[underlayAmount]; + for (int i = 0; i < underlayAmount; i++) { + if (underlays[i] == null) { + underlays[i] = new FloorDefinition(); + } + underlays[i].readValuesUnderlay(buffer); + underlays[i].generateHsl(); + } + + // buffer = ByteBuffer.wrap(archive.readFile("flo2.dat")); + int overlayAmount = buffer.getShort(); + System.out.println("Overlay Floors Loaded: " + overlayAmount); + overlays = new FloorDefinition[overlayAmount]; + for (int i = 0; i < overlayAmount; i++) { + if (overlays[i] == null) { + overlays[i] = new FloorDefinition(); + } + overlays[i].readValuesOverlay(buffer); + overlays[i].generateHsl(); + } + } + + private FloorDefinition() { + texture = -1; + occlude = true; + } + + public int texture; + public int rgb; + public boolean occlude; + public int anotherRgb; + public int hue; + public int saturation; + public int luminance; + public int anotherHue; + public int anotherSaturation; + public int anotherLuminance; + public int blendHue; + public int blendHueMultiplier; + public int hsl16; + + private void generateHsl() { + if (anotherRgb != -1) { + rgbToHsl(anotherRgb); + anotherHue = hue; + anotherSaturation = saturation; + anotherLuminance = luminance; + } + rgbToHsl(rgb); + } + + private void readValuesUnderlay(ByteBuffer buffer) { + for (;;) { + int opcode = buffer.get(); + if (opcode == 0) { + break; + } else if (opcode == 1) { + rgb = ((buffer.get() & 0xff) << 16) + ((buffer.get() & 0xff) << 8) + (buffer.get() & 0xff); + } else { + System.out.println("Error unrecognised underlay code: " + opcode); + } + } + } + + private void readValuesOverlay(ByteBuffer buffer) { + for (;;) { + int opcode = buffer.get(); + if (opcode == 0) { + break; + } else if (opcode == 1) { + rgb = ((buffer.get() & 0xff) << 16) + ((buffer.get() & 0xff) << 8) + (buffer.get() & 0xff); + } else if (opcode == 2) { + texture = buffer.get() & 0xff; + } else if (opcode == 5) { + occlude = false; + } else if (opcode == 7) { + anotherRgb = ((buffer.get() & 0xff) << 16) + ((buffer.get() & 0xff) << 8) + (buffer.get() & 0xff); + } else { + System.out.println("Error unrecognised overlay code: " + opcode); + } + } + } - public static void init(FileArchive archive) { - ByteBuffer buffer = ByteBuffer.wrap(archive.readFile("flo.dat")); - int underlayAmount = buffer.getShort(); - System.out.println("Underlay Floors Loaded: "+underlayAmount); - underlays = new FloorDefinition[underlayAmount]; - for (int i = 0; i < underlayAmount; i++) { - if (underlays[i] == null) { - underlays[i] = new FloorDefinition(); - } - underlays[i].readValuesUnderlay(buffer); - underlays[i].generateHsl(); - } - - // buffer = ByteBuffer.wrap(archive.readFile("flo2.dat")); - int overlayAmount = buffer.getShort(); - System.out.println("Overlay Floors Loaded: "+overlayAmount); - overlays = new FloorDefinition[overlayAmount]; - for (int i = 0; i < overlayAmount; i++) { - if (overlays[i] == null) { - overlays[i] = new FloorDefinition(); - } - overlays[i].readValuesOverlay(buffer); - overlays[i].generateHsl(); - } - } - - private FloorDefinition() { - texture = -1; - occlude = true; - } - - public int texture; - public int rgb; - public boolean occlude; - public int anotherRgb; - public int hue; - public int saturation; - public int luminance; - public int anotherHue; - public int anotherSaturation; - public int anotherLuminance; - public int blendHue; - public int blendHueMultiplier; - public int hsl16; - - private void generateHsl() { - if (anotherRgb != -1) { - rgbToHsl(anotherRgb); - anotherHue = hue; - anotherSaturation = saturation; - anotherLuminance = luminance; - } - rgbToHsl(rgb); - } - - private void readValuesUnderlay(ByteBuffer buffer) { - for (;;) { - int opcode = buffer.get(); - if (opcode == 0) { - break; - } else if (opcode == 1) { - rgb = ((buffer.get() & 0xff) << 16) + ((buffer.get() & 0xff) << 8) + (buffer.get() & 0xff); - } else { - System.out.println("Error unrecognised underlay code: " + opcode); - } - } - } - - private void readValuesOverlay(ByteBuffer buffer) { - for (;;) { - int opcode = buffer.get(); - if (opcode == 0) { - break; - } else if (opcode == 1) { - rgb = ((buffer.get() & 0xff) << 16) + ((buffer.get() & 0xff) << 8) + (buffer.get() & 0xff); - } else if (opcode == 2) { - texture = buffer.get() & 0xff; - } else if (opcode == 5) { - occlude = false; - } else if (opcode == 7) { - anotherRgb = ((buffer.get() & 0xff) << 16) + ((buffer.get() & 0xff) << 8) + (buffer.get() & 0xff); - } else { - System.out.println("Error unrecognised overlay code: " + opcode); - } - } - } - - private void rgbToHsl(int rgb) { - double r = (rgb >> 16 & 0xff) / 256.0; - double g = (rgb >> 8 & 0xff) / 256.0; - double b = (rgb & 0xff) / 256.0; - double min = r; - if (g < min) { - min = g; - } - if (b < min) { - min = b; - } - double max = r; - if (g > max) { - max = g; - } - if (b > max) { - max = b; - } - double h = 0.0; - double s = 0.0; - double l = (min + max) / 2.0; - if (min != max) { - if (l < 0.5) { - s = (max - min) / (max + min); - } - if (l >= 0.5) { - s = (max - min) / (2.0 - max - min); - } - if (r == max) { - h = (g - b) / (max - min); - } else if (g == max) { - h = 2.0 + (b - r) / (max - min); - } else if (b == max) { - h = 4.0 + (r - g) / (max - min); - } - } - h /= 6.0; - hue = (int) (h * 256.0); - saturation = (int) (s * 256.0); - luminance = (int) (l * 256.0); - if (saturation < 0) { - saturation = 0; - } else if (saturation > 255) { - saturation = 255; - } - if (luminance < 0) { - luminance = 0; - } else if (luminance > 255) { - luminance = 255; - } - if (l > 0.5) { - blendHueMultiplier = (int) ((1.0 - l) * s * 512.0); - } else { - blendHueMultiplier = (int) (l * s * 512.0); - } - if (blendHueMultiplier < 1) { - blendHueMultiplier = 1; - } - blendHue = (int) (h * blendHueMultiplier); - hsl16 = hsl24to16(hue, saturation, luminance); - } + private void rgbToHsl(int rgb) { + double r = (rgb >> 16 & 0xff) / 256.0; + double g = (rgb >> 8 & 0xff) / 256.0; + double b = (rgb & 0xff) / 256.0; + double min = r; + if (g < min) { + min = g; + } + if (b < min) { + min = b; + } + double max = r; + if (g > max) { + max = g; + } + if (b > max) { + max = b; + } + double h = 0.0; + double s = 0.0; + double l = (min + max) / 2.0; + if (min != max) { + if (l < 0.5) { + s = (max - min) / (max + min); + } + if (l >= 0.5) { + s = (max - min) / (2.0 - max - min); + } + if (r == max) { + h = (g - b) / (max - min); + } else if (g == max) { + h = 2.0 + (b - r) / (max - min); + } else if (b == max) { + h = 4.0 + (r - g) / (max - min); + } + } + h /= 6.0; + hue = (int) (h * 256.0); + saturation = (int) (s * 256.0); + luminance = (int) (l * 256.0); + if (saturation < 0) { + saturation = 0; + } else if (saturation > 255) { + saturation = 255; + } + if (luminance < 0) { + luminance = 0; + } else if (luminance > 255) { + luminance = 255; + } + if (l > 0.5) { + blendHueMultiplier = (int) ((1.0 - l) * s * 512.0); + } else { + blendHueMultiplier = (int) (l * s * 512.0); + } + if (blendHueMultiplier < 1) { + blendHueMultiplier = 1; + } + blendHue = (int) (h * blendHueMultiplier); + hsl16 = hsl24to16(hue, saturation, luminance); + } - private final static int hsl24to16(int h, int s, int l) { - if (l > 179) { - s /= 2; - } - if (l > 192) { - s /= 2; - } - if (l > 217) { - s /= 2; - } - if (l > 243) { - s /= 2; - } - return (h / 4 << 10) + (s / 32 << 7) + l / 2; - } + private final static int hsl24to16(int h, int s, int l) { + if (l > 179) { + s /= 2; + } + if (l > 192) { + s /= 2; + } + if (l > 217) { + s /= 2; + } + if (l > 243) { + s /= 2; + } + return (h / 4 << 10) + (s / 32 << 7) + l / 2; + } } diff --git a/Elvarg - Client/src/com/runescape/cache/def/ItemDefinition.java b/Elvarg - Client/src/com/runescape/cache/def/ItemDefinition.java index bf5e7de..35d3b16 100644 --- a/Elvarg - Client/src/com/runescape/cache/def/ItemDefinition.java +++ b/Elvarg - Client/src/com/runescape/cache/def/ItemDefinition.java @@ -2,7 +2,6 @@ import org.seven.util.FileUtils; -import com.runescape.Configuration; import com.runescape.cache.graphics.Sprite; import com.runescape.collection.ReferenceCache; import com.runescape.draw.Rasterizer2D; @@ -39,14 +38,14 @@ public boolean isDialogueModelCached(int gender) { } public static void init(byte[] idx, byte[] dat) { - //item_data = new Buffer(archive.readFile("obj.dat")); - //Buffer stream = new Buffer(archive.readFile("obj.idx")); - + // item_data = new Buffer(archive.readFile("obj.dat")); + // Buffer stream = new Buffer(archive.readFile("obj.idx")); + Buffer stream = null; - + item_data = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "obj.dat")); stream = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "obj.idx")); - + item_count = stream.readUShort() + 21; streamIndices = new int[item_count + 50000]; int offset = 2; @@ -55,14 +54,14 @@ public static void init(byte[] idx, byte[] dat) { streamIndices[_ctr] = offset; offset += stream.readUShort(); } - + cache = new ItemDefinition[10]; - + for (int _ctr = 0; _ctr < 10; _ctr++) { cache[_ctr] = new ItemDefinition(); } - - System.out.println("Loaded: "+item_count+" Items"); + + System.out.println("Loaded: " + item_count + " Items"); } public Model getChatEquipModel(int gender) { @@ -113,13 +112,13 @@ public Model getEquippedModel(int gender) { int primaryModel = equipped_model_male_1; int secondaryModel = equipped_model_male_2; int emblem = equipped_model_male_3; - + if (gender == 1) { primaryModel = equipped_model_female_1; secondaryModel = equipped_model_female_2; emblem = equipped_model_female_3; } - + if (primaryModel == -1) return null; Model primaryModel_ = Model.getModel(primaryModel); @@ -138,7 +137,7 @@ public Model getEquippedModel(int gender) { primaryModel_.translate(0, equipped_model_male_translation_y, 0); if (gender == 1 && equipped_model_female_translation_y != 0) primaryModel_.translate(0, equipped_model_female_translation_y, 0); - + if (modified_model_colors != null) { for (int i1 = 0; i1 < modified_model_colors.length; i1++) primaryModel_.recolor(modified_model_colors[i1], original_model_colors[i1]); @@ -187,8 +186,7 @@ private void setDefaults() { light_mag = 0; team = 0; } - - + public static ItemDefinition lookup(int itemId) { for (int count = 0; count < 10; count++) if (cache[count].id == itemId) @@ -200,10 +198,10 @@ public static ItemDefinition lookup(int itemId) { itemDef.id = itemId; itemDef.setDefaults(); itemDef.readValues(item_data); - + if (itemDef.noted_item_id != -1) itemDef.toNote(); - + /** * Place customs here */ @@ -294,9 +292,9 @@ public static Sprite getSprite(int itemId, int stackSize, int outlineColor) { Rasterizer3D.useViewport(); int k3 = itemDef.model_zoom; if (outlineColor == -1) - k3 = (int) ((double) k3 * 1.5D); + k3 = (int) (k3 * 1.5D); if (outlineColor > 0) - k3 = (int) ((double) k3 * 1.04D); + k3 = (int) (k3 * 1.04D); int l3 = Rasterizer3D.anIntArray1470[itemDef.rotation_y] * k3 >> 16; int i4 = Rasterizer3D.COSINE[itemDef.rotation_y] * k3 >> 16; model.method482(itemDef.rotation_x, itemDef.rotation_z, itemDef.rotation_y, itemDef.translate_x, @@ -495,21 +493,21 @@ else if (opCode == 97) else if (opCode == 98) noted_item_id = buffer.readUShort(); else if (opCode >= 100 && opCode < 110) { - + if (stack_variant_id == null) { stack_variant_id = new int[10]; stack_variant_size = new int[10]; } stack_variant_id[opCode - 100] = buffer.readUShort(); stack_variant_size[opCode - 100] = buffer.readUShort(); - - /*int length = buffer.readUnsignedByte(); - stack_variant_id = new int [length]; - stack_variant_size = new int[length]; - for (int i2 = 0; i2< length; i2++) { - stack_variant_id[i2] = buffer.readUShort(); - stack_variant_size[i2] = buffer.readUShort(); - }*/ + + /* + * int length = buffer.readUnsignedByte(); stack_variant_id = + * new int [length]; stack_variant_size = new int[length]; for + * (int i2 = 0; i2< length; i2++) { stack_variant_id[i2] = + * buffer.readUShort(); stack_variant_size[i2] = + * buffer.readUShort(); } + */ } else if (opCode == 110) model_scale_x = buffer.readUShort(); else if (opCode == 111) diff --git a/Elvarg - Client/src/com/runescape/cache/def/NpcDefinition.java b/Elvarg - Client/src/com/runescape/cache/def/NpcDefinition.java index ba5b8b0..3322e83 100644 --- a/Elvarg - Client/src/com/runescape/cache/def/NpcDefinition.java +++ b/Elvarg - Client/src/com/runescape/cache/def/NpcDefinition.java @@ -50,14 +50,15 @@ public final class NpcDefinition { public static ReferenceCache modelCache = new ReferenceCache(30); public int id; - + /** * Lookup an NpcDefinition by its id + * * @param id */ public static NpcDefinition lookup(int id) { for (int index = 0; index < 20; index++) - if (cache[index].interfaceType == (long) id) + if (cache[index].interfaceType == id) return cache[index]; anInt56 = (anInt56 + 1) % 20; @@ -66,13 +67,13 @@ public static NpcDefinition lookup(int id) { definition.interfaceType = id; definition.id = id; definition.readValues(dataBuf); - switch(id) { + switch (id) { case 1274: definition.combatLevel = 35; break; case 2660: definition.combatLevel = 0; - definition.actions = new String[] {"Trade", null, null, null, null, null, null}; + definition.actions = new String[] { "Trade", null, null, null, null, null, null }; definition.name = "Pker"; break; case 6477: @@ -88,30 +89,29 @@ public static NpcDefinition lookup(int id) { definition.drawMinimapDot = true; break; case 1306: - definition.actions = new String[] {"Make-over", null, null, null, null, null, null}; + definition.actions = new String[] { "Make-over", null, null, null, null, null, null }; break; case 3309: definition.name = "Mage"; - definition.actions = new String[] {"Trade", null, "Equipment", "Runes", null, null, null}; + definition.actions = new String[] { "Trade", null, "Equipment", "Runes", null, null, null }; break; case 1158: - definition.actions = new String[] {"Trade", null, "Equipment", "Weapons", null, null, null}; + definition.actions = new String[] { "Trade", null, "Equipment", "Weapons", null, null, null }; break; case 1576: - definition.actions = new String[] {"Trade", null, "Equipment", "Ammunition", null, null, null}; + definition.actions = new String[] { "Trade", null, "Equipment", "Ammunition", null, null, null }; break; case 3343: - definition.actions = new String[] {"Trade", null, "Heal", null, null, null, null}; + definition.actions = new String[] { "Trade", null, "Heal", null, null, null, null }; break; case 506: case 526: - definition.actions = new String[] {"Trade", null, null, null, null, null, null}; + definition.actions = new String[] { "Trade", null, null, null, null, null, null }; break; case 315: - definition.actions = new String[] {"Talk-to", null, "Trade", "Sell Emblems", "Request Skull", null, null}; + definition.actions = new String[] { "Talk-to", null, "Trade", "Sell Emblems", "Request Skull", null, null }; break; - - + } return definition; } @@ -161,34 +161,33 @@ public NpcDefinition morph() { child = clientInstance.settings[variable] >> low & mask; } else if (settingId != -1) child = clientInstance.settings[settingId]; - if (child < 0 || child >= childrenIDs.length - || childrenIDs[child] == -1) + if (child < 0 || child >= childrenIDs.length || childrenIDs[child] == -1) return null; else return lookup(childrenIDs[child]); } - public static void init(FileArchive archive) { - dataBuf = new Buffer(archive.readFile("npc.dat")); - Buffer idxBuf = new Buffer(archive.readFile("npc.idx")); - - int size = idxBuf.readUShort(); - - offsets = new int[size]; - + public static void init(FileArchive archive) { + dataBuf = new Buffer(archive.readFile("npc.dat")); + Buffer idxBuf = new Buffer(archive.readFile("npc.idx")); + + int size = idxBuf.readUShort(); + + offsets = new int[size]; + int offset = 2; - + for (int count = 0; count < size; count++) { offsets[count] = offset; offset += idxBuf.readUShort(); } cache = new NpcDefinition[20]; - + for (int count = 0; count < 20; count++) { cache[count] = new NpcDefinition(); - } - + } + System.out.println("Loaded: " + size + " Npcs"); } @@ -199,8 +198,7 @@ public static void clear() { dataBuf = null; } - public Model method164(int j, int somethingCurrentAnimsFrameNumber, int ai[], int nextFrame, int idk, - int idk2) { + public Model method164(int j, int somethingCurrentAnimsFrameNumber, int ai[], int nextFrame, int idk, int idk2) { if (childrenIDs != null) { NpcDefinition entityDef = morph(); if (entityDef == null) @@ -232,14 +230,12 @@ public Model method164(int j, int somethingCurrentAnimsFrameNumber, int ai[], in } model.skin(); model.scale(132, 132, 132); - model.light(84 + lightModifier, 1000 + shadowModifier, -90, -580, - -90, true); + model.light(84 + lightModifier, 1000 + shadowModifier, -90, -580, -90, true); modelCache.put(model, interfaceType); } Model empty = Model.EMPTY_MODEL; - empty.method464(model, - Frame.noAnimationInProgress(somethingCurrentAnimsFrameNumber) & Frame.noAnimationInProgress(j) - & Frame.noAnimationInProgress(nextFrame)); + empty.method464(model, Frame.noAnimationInProgress(somethingCurrentAnimsFrameNumber) + & Frame.noAnimationInProgress(j) & Frame.noAnimationInProgress(nextFrame)); if (somethingCurrentAnimsFrameNumber != -1 && j != -1) empty.applyAnimationFrames(ai, j, somethingCurrentAnimsFrameNumber); else if (somethingCurrentAnimsFrameNumber != -1 && nextFrame != -1) @@ -256,15 +252,13 @@ else if (somethingCurrentAnimsFrameNumber != -1) return empty; } - public Model getAnimatedModel(int primaryFrame, int secondaryFrame, - int interleaveOrder[]) { + public Model getAnimatedModel(int primaryFrame, int secondaryFrame, int interleaveOrder[]) { if (childrenIDs != null) { NpcDefinition definition = morph(); if (definition == null) return null; else - return definition.getAnimatedModel(primaryFrame, - secondaryFrame, interleaveOrder); + return definition.getAnimatedModel(primaryFrame, secondaryFrame, interleaveOrder); } Model model = (Model) modelCache.get(interfaceType); if (model == null) { @@ -285,18 +279,16 @@ public Model getAnimatedModel(int primaryFrame, int secondaryFrame, model = new Model(models.length, models); if (recolourOriginal != null) { for (int index = 0; index < recolourOriginal.length; index++) - model.recolor(recolourOriginal[index], - recolourTarget[index]); + model.recolor(recolourOriginal[index], recolourTarget[index]); } model.skin(); - model.light(64 + lightModifier, 850 + shadowModifier, -30, -50, - -30, true); + model.light(64 + lightModifier, 850 + shadowModifier, -30, -50, -30, true); modelCache.put(model, interfaceType); } Model model_1 = Model.EMPTY_MODEL; - model_1.method464(model, Frame.noAnimationInProgress(secondaryFrame) - & Frame.noAnimationInProgress(primaryFrame)); + model_1.method464(model, + Frame.noAnimationInProgress(secondaryFrame) & Frame.noAnimationInProgress(primaryFrame)); if (secondaryFrame != -1 && primaryFrame != -1) model_1.applyAnimationFrames(interleaveOrder, primaryFrame, secondaryFrame); else if (secondaryFrame != -1) @@ -327,7 +319,7 @@ public void readValues(Buffer stream) { else if (opCode == 3) description = stream.readBytes(); else if (opCode == 12) - size = stream.readSignedByte(); + size = stream.readSignedByte(); else if (opCode == 13) standAnim = stream.readUShort(); else if (opCode == 14) diff --git a/Elvarg - Client/src/com/runescape/cache/def/ObjectDefinition.java b/Elvarg - Client/src/com/runescape/cache/def/ObjectDefinition.java index 7f6f653..e54738a 100644 --- a/Elvarg - Client/src/com/runescape/cache/def/ObjectDefinition.java +++ b/Elvarg - Client/src/com/runescape/cache/def/ObjectDefinition.java @@ -1,6 +1,7 @@ package com.runescape.cache.def; import java.io.IOException; + import com.runescape.Client; import com.runescape.cache.FileArchive; import com.runescape.cache.anim.Frame; @@ -97,32 +98,22 @@ public static ObjectDefinition lookup(int id) { || id == 25891 || id == 26082 || id == 26081 || id == 1530 || id == 16776 || id == 16778 || id == 28589 || id == 1533 || id == 17089 || id == 1600 || id == 1601 || id == 11707 || id == 24376 || id == 24378 || id == 40108 || id == 59 || id == 2069 || id == 36846; - if (objectDef.name != null) { - if (objectDef.name.toLowerCase().contains(("door")) || objectDef.name.toLowerCase().contains(("gate")) - || objectDef.name.toLowerCase().contains(("ditch"))) { - removeObject = true; - } - } - if (removeObject) { objectDef.modelIds = null; objectDef.isInteractive = false; objectDef.solid = false; return objectDef; } - if (id == 6552) { objectDef.interactions = new String[5]; objectDef.interactions[0] = "Toggle-spells"; objectDef.name = "Ancient altar"; } - if (id == 14911) { objectDef.interactions = new String[5]; objectDef.interactions[0] = "Toggle-spells"; objectDef.name = "Lunar altar"; } - if (id == 7149 || id == 7147) { objectDef.isInteractive = true; objectDef.interactions = new String[5]; @@ -342,7 +333,7 @@ public Model model(int j, int k, int l) { if (modelTypes == null) { if (j != 10) return null; - l1 = (long) ((type << 6) + l) + ((long) (k + 1) << 32); + l1 = (type << 6) + l + ((long) (k + 1) << 32); Model model_1 = (Model) models.get(l1); if (model_1 != null) { applyTexture(model_1); @@ -382,7 +373,7 @@ public Model model(int j, int k, int l) { if (i1 == -1) return null; - l1 = (long) ((type << 8) + (i1 << 3) + l) + ((long) (k + 1) << 32); + l1 = (type << 8) + (i1 << 3) + l + ((long) (k + 1) << 32); Model model_2 = (Model) models.get(l1); if (model_2 != null) { applyTexture(model_2); diff --git a/Elvarg - Client/src/com/runescape/cache/graphics/GameFont.java b/Elvarg - Client/src/com/runescape/cache/graphics/GameFont.java index 4cc36fe..b185d2f 100644 --- a/Elvarg - Client/src/com/runescape/cache/graphics/GameFont.java +++ b/Elvarg - Client/src/com/runescape/cache/graphics/GameFont.java @@ -9,56 +9,56 @@ public final class GameFont extends Rasterizer2D { public GameFont(boolean flag, String s, FileArchive streamLoader) { - aByteArrayArray1491 = new byte[256][]; - anIntArray1492 = new int[256]; - anIntArray1493 = new int[256]; - anIntArray1494 = new int[256]; - anIntArray1495 = new int[256]; - anIntArray1496 = new int[256]; - aRandom1498 = new Random(); - aBoolean1499 = false; - Buffer stream = new Buffer(streamLoader.readFile(s + ".dat")); - Buffer stream_1 = new Buffer(streamLoader.readFile("index.dat")); - stream_1.currentPosition = stream.readUShort() + 4; - int k = stream_1.readUnsignedByte(); - if(k > 0) - stream_1.currentPosition += 3 * (k - 1); - for(int l = 0; l < 256; l++) { - anIntArray1494[l] = stream_1.readUnsignedByte(); - anIntArray1495[l] = stream_1.readUnsignedByte(); - int i1 = anIntArray1492[l] = stream_1.readUShort(); - int j1 = anIntArray1493[l] = stream_1.readUShort(); - int k1 = stream_1.readUnsignedByte(); - int l1 = i1 * j1; - aByteArrayArray1491[l] = new byte[l1]; - if(k1 == 0) { - for(int i2 = 0; i2 < l1; i2++) - aByteArrayArray1491[l][i2] = stream.readSignedByte(); + aByteArrayArray1491 = new byte[256][]; + anIntArray1492 = new int[256]; + anIntArray1493 = new int[256]; + anIntArray1494 = new int[256]; + anIntArray1495 = new int[256]; + anIntArray1496 = new int[256]; + aRandom1498 = new Random(); + aBoolean1499 = false; + Buffer stream = new Buffer(streamLoader.readFile(s + ".dat")); + Buffer stream_1 = new Buffer(streamLoader.readFile("index.dat")); + stream_1.currentPosition = stream.readUShort() + 4; + int k = stream_1.readUnsignedByte(); + if (k > 0) + stream_1.currentPosition += 3 * (k - 1); + for (int l = 0; l < 256; l++) { + anIntArray1494[l] = stream_1.readUnsignedByte(); + anIntArray1495[l] = stream_1.readUnsignedByte(); + int i1 = anIntArray1492[l] = stream_1.readUShort(); + int j1 = anIntArray1493[l] = stream_1.readUShort(); + int k1 = stream_1.readUnsignedByte(); + int l1 = i1 * j1; + aByteArrayArray1491[l] = new byte[l1]; + if (k1 == 0) { + for (int i2 = 0; i2 < l1; i2++) + aByteArrayArray1491[l][i2] = stream.readSignedByte(); - } else if(k1 == 1) { - for(int j2 = 0; j2 < i1; j2++) { - for(int l2 = 0; l2 < j1; l2++) - aByteArrayArray1491[l][j2 + l2 * i1] = stream.readSignedByte(); + } else if (k1 == 1) { + for (int j2 = 0; j2 < i1; j2++) { + for (int l2 = 0; l2 < j1; l2++) + aByteArrayArray1491[l][j2 + l2 * i1] = stream.readSignedByte(); } } - if(j1 > verticalSpace && l < 128) + if (j1 > verticalSpace && l < 128) verticalSpace = j1; anIntArray1494[l] = 1; anIntArray1496[l] = i1 + 2; int k2 = 0; - for(int i3 = j1 / 7; i3 < j1; i3++) + for (int i3 = j1 / 7; i3 < j1; i3++) k2 += aByteArrayArray1491[l][i3 * i1]; - if(k2 <= j1 / 7) { + if (k2 <= j1 / 7) { anIntArray1496[l]--; anIntArray1494[l] = 0; } k2 = 0; - for(int j3 = j1 / 7; j3 < j1; j3++) + for (int j3 = j1 / 7; j3 < j1; j3++) k2 += aByteArrayArray1491[l][(i1 - 1) + j3 * i1]; - if(k2 <= j1 / 7) + if (k2 <= j1 / 7) anIntArray1496[l]--; } - if(flag) { + if (flag) { anIntArray1496[32] = anIntArray1496[73]; } else { anIntArray1496[32] = anIntArray1496[105]; @@ -82,11 +82,11 @@ public void drawChatInput(int i, int j, String s, int l, boolean flag) { } public int getTextWidth(String s) { - if(s == null) + if (s == null) return 0; int j = 0; - for(int k = 0; k < s.length(); k++) - if(s.charAt(k) == '@' && k + 4 < s.length() && s.charAt(k + 4) == '@') + for (int k = 0; k < s.length(); k++) + if (s.charAt(k) == '@' && k + 4 < s.length() && s.charAt(k + 4) == '@') k += 4; else j += anIntArray1496[s.charAt(k)]; @@ -94,64 +94,71 @@ public int getTextWidth(String s) { } public int method384(String s) { - if(s == null) + if (s == null) return 0; int j = 0; - for(int k = 0; k < s.length(); k++) + for (int k = 0; k < s.length(); k++) j += anIntArray1496[s.charAt(k)]; return j; } public void render(int i, String s, int j, int l) { - if(s == null) + if (s == null) return; j -= verticalSpace; - for(int i1 = 0; i1 < s.length(); i1++) { + for (int i1 = 0; i1 < s.length(); i1++) { char c = s.charAt(i1); - if(c != ' ') - method392(aByteArrayArray1491[c], l + anIntArray1494[c], j + anIntArray1495[c], anIntArray1492[c], anIntArray1493[c], i); + if (c != ' ') + method392(aByteArrayArray1491[c], l + anIntArray1494[c], j + anIntArray1495[c], anIntArray1492[c], + anIntArray1493[c], i); l += anIntArray1496[c]; } } public void wave(int i, String s, int j, int k, int l) { - if(s == null) + if (s == null) return; j -= method384(s) / 2; l -= verticalSpace; - for(int i1 = 0; i1 < s.length(); i1++) { + for (int i1 = 0; i1 < s.length(); i1++) { char c = s.charAt(i1); - if(c != ' ') - method392(aByteArrayArray1491[c], j + anIntArray1494[c], l + anIntArray1495[c] + (int)(Math.sin((double)i1 / 2D + (double)k / 5D) * 5D), anIntArray1492[c], anIntArray1493[c], i); + if (c != ' ') + method392(aByteArrayArray1491[c], j + anIntArray1494[c], + l + anIntArray1495[c] + (int) (Math.sin(i1 / 2D + k / 5D) * 5D), anIntArray1492[c], + anIntArray1493[c], i); j += anIntArray1496[c]; } } public void wave2(int i, String s, int j, int k, int l) { - if(s == null) + if (s == null) return; i -= method384(s) / 2; k -= verticalSpace; - for(int i1 = 0; i1 < s.length(); i1++) { + for (int i1 = 0; i1 < s.length(); i1++) { char c = s.charAt(i1); - if(c != ' ') - method392(aByteArrayArray1491[c], i + anIntArray1494[c] + (int)(Math.sin((double)i1 / 5D + (double)j / 5D) * 5D), k + anIntArray1495[c] + (int)(Math.sin((double)i1 / 3D + (double)j / 5D) * 5D), anIntArray1492[c], anIntArray1493[c], l); + if (c != ' ') + method392(aByteArrayArray1491[c], i + anIntArray1494[c] + (int) (Math.sin(i1 / 5D + j / 5D) * 5D), + k + anIntArray1495[c] + (int) (Math.sin(i1 / 3D + j / 5D) * 5D), anIntArray1492[c], + anIntArray1493[c], l); i += anIntArray1496[c]; } } public void shake(int i, String s, int j, int k, int l, int i1) { - if(s == null) + if (s == null) return; - double d = 7D - (double)i / 8D; - if(d < 0.0D) + double d = 7D - i / 8D; + if (d < 0.0D) d = 0.0D; l -= method384(s) / 2; k -= verticalSpace; - for(int k1 = 0; k1 < s.length(); k1++) { + for (int k1 = 0; k1 < s.length(); k1++) { char c = s.charAt(k1); - if(c != ' ') - method392(aByteArrayArray1491[c], l + anIntArray1494[c], k + anIntArray1495[c] + (int)(Math.sin((double)k1 / 1.5D + (double)j) * d), anIntArray1492[c], anIntArray1493[c], i1); + if (c != ' ') + method392(aByteArrayArray1491[c], l + anIntArray1494[c], + k + anIntArray1495[c] + (int) (Math.sin(k1 / 1.5D + j) * d), anIntArray1492[c], + anIntArray1493[c], i1); l += anIntArray1496[c]; } } @@ -159,213 +166,216 @@ public void shake(int i, String s, int j, int k, int l, int i1) { public void drawTextWithPotentialShadow(boolean flag1, int i, int j, String s, int k) { aBoolean1499 = false; int l = i; - if(s == null) + if (s == null) return; k -= verticalSpace; - for(int i1 = 0; i1 < s.length(); i1++) - if(s.charAt(i1) == '@' && i1 + 4 < s.length() && s.charAt(i1 + 4) == '@') { + 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) + if (j1 != -1) j = 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); - method392(aByteArrayArray1491[c], i + anIntArray1494[c], k + anIntArray1495[c], anIntArray1492[c], anIntArray1493[c], j); + if (c != ' ') { + if (flag1) + method392(aByteArrayArray1491[c], i + anIntArray1494[c] + 1, k + anIntArray1495[c] + 1, + anIntArray1492[c], anIntArray1493[c], 0); + method392(aByteArrayArray1491[c], i + anIntArray1494[c], k + anIntArray1495[c], anIntArray1492[c], + anIntArray1493[c], j); } i += anIntArray1496[c]; } - if(aBoolean1499) - Rasterizer2D.drawHorizontalLine(l, k + (int)((double)verticalSpace * 0.69999999999999996D), i - l, 0x800000); + if (aBoolean1499) + Rasterizer2D.drawHorizontalLine(l, k + (int) (verticalSpace * 0.69999999999999996D), i - l, 0x800000); } public void method390(int i, int j, String s, int k, int i1) { - if(s == null) + if (s == null) return; aRandom1498.setSeed(k); int j1 = 192 + (aRandom1498.nextInt() & 0x1f); i1 -= verticalSpace; - for(int k1 = 0; k1 < s.length(); k1++) - if(s.charAt(k1) == '@' && k1 + 4 < s.length() && s.charAt(k1 + 4) == '@') { + for (int k1 = 0; k1 < s.length(); k1++) + if (s.charAt(k1) == '@' && k1 + 4 < s.length() && s.charAt(k1 + 4) == '@') { int l1 = getColorByName(s.substring(k1 + 1, k1 + 4)); - if(l1 != -1) + if (l1 != -1) j = l1; k1 += 4; } else { char c = s.charAt(k1); - if(c != ' ') { - method394(192, i + anIntArray1494[c] + 1, aByteArrayArray1491[c], anIntArray1492[c], i1 + anIntArray1495[c] + 1, anIntArray1493[c], 0); - method394(j1, i + anIntArray1494[c], aByteArrayArray1491[c], anIntArray1492[c], i1 + anIntArray1495[c], anIntArray1493[c], j); + if (c != ' ') { + method394(192, i + anIntArray1494[c] + 1, aByteArrayArray1491[c], anIntArray1492[c], + i1 + anIntArray1495[c] + 1, anIntArray1493[c], 0); + method394(j1, i + anIntArray1494[c], aByteArrayArray1491[c], anIntArray1492[c], + i1 + anIntArray1495[c], anIntArray1493[c], j); } i += anIntArray1496[c]; - if((aRandom1498.nextInt() & 3) == 0) + if ((aRandom1498.nextInt() & 3) == 0) i++; } } private int getColorByName(String s) { - if(s.equals("369"))//color code, use as @###@ - return 0x336699;//hex code - if(s.equals("mon")) + if (s.equals("369"))// color code, use as @###@ + return 0x336699;// hex code + if (s.equals("mon")) return 0x00ff80; - if(s.equals("red")) + if (s.equals("red")) return 0xff0000; - if(s.equals("gre")) + if (s.equals("gre")) return 65280; - if(s.equals("blu")) + if (s.equals("blu")) return 255; - if(s.equals("yel")) + if (s.equals("yel")) return 0xffff00; - if(s.equals("cya")) + if (s.equals("cya")) return 65535; - if(s.equals("mag")) + if (s.equals("mag")) return 0xff00ff; - if(s.equals("whi")) + if (s.equals("whi")) return 0xffffff; - if(s.equals("bla")) + if (s.equals("bla")) return 0; - if(s.equals("lre")) + if (s.equals("lre")) return 0xff9040; - if(s.equals("dre")) + if (s.equals("dre")) return 0x800000; - if(s.equals("dbl")) + if (s.equals("dbl")) return 128; - if(s.equals("or1")) + if (s.equals("or1")) return 0xffb000; - if(s.equals("or2")) + if (s.equals("or2")) return 0xff7000; - if(s.equals("or3")) + if (s.equals("or3")) return 0xff3000; - if(s.equals("gr1")) + if (s.equals("gr1")) return 0xc0ff00; - if(s.equals("gr2")) + if (s.equals("gr2")) return 0x80ff00; - if(s.equals("gr3")) + if (s.equals("gr3")) return 0x40ff00; - if(s.equals("str")) + if (s.equals("str")) aBoolean1499 = true; - if(s.equals("end")) + if (s.equals("end")) aBoolean1499 = false; return -1; } private void method392(byte abyte0[], int i, int j, int k, int l, int i1) { - int j1 = i + j * width; - int k1 = width - k; - int l1 = 0; - int i2 = 0; - if (j < topY) { - int j2 = topY - j; - l -= j2; - j = topY; - i2 += j2 * k; - j1 += j2 * width; - } - if (j + l >= bottomY) - l -= ((j + l) - bottomY); - if (i < leftX) { - int k2 = leftX - i; - k -= k2; - i = leftX; - i2 += k2; - j1 += k2; - l1 += k2; - k1 += k2; - } - if (i + k >= bottomX) { - int l2 = ((i + k) - bottomX); - k -= l2; - l1 += l2; - k1 += l2; - } - if (!(k <= 0 || l <= 0)) { - method393(pixels, abyte0, i1, i2, j1, k, l, k1, l1); - } - } + int j1 = i + j * width; + int k1 = width - k; + int l1 = 0; + int i2 = 0; + if (j < topY) { + int j2 = topY - j; + l -= j2; + j = topY; + i2 += j2 * k; + j1 += j2 * width; + } + if (j + l >= bottomY) + l -= ((j + l) - bottomY); + if (i < leftX) { + int k2 = leftX - i; + k -= k2; + i = leftX; + i2 += k2; + j1 += k2; + l1 += k2; + k1 += k2; + } + if (i + k >= bottomX) { + int l2 = ((i + k) - bottomX); + k -= l2; + l1 += l2; + k1 += l2; + } + if (!(k <= 0 || l <= 0)) { + method393(pixels, abyte0, i1, i2, j1, k, l, k1, l1); + } + } private void method393(int ai[], byte abyte0[], int i, int j, int k, int l, int i1, int j1, int k1) { int l1 = -(l >> 2); l = -(l & 3); - for(int i2 = -i1; i2 < 0; i2++) { - for(int j2 = l1; j2 < 0; j2++) { - if(abyte0[j++] != 0) + for (int i2 = -i1; i2 < 0; i2++) { + for (int j2 = l1; j2 < 0; j2++) { + if (abyte0[j++] != 0) ai[k++] = i; else k++; - if(abyte0[j++] != 0) + if (abyte0[j++] != 0) ai[k++] = i; else k++; - if(abyte0[j++] != 0) + if (abyte0[j++] != 0) ai[k++] = i; else k++; - if(abyte0[j++] != 0) + if (abyte0[j++] != 0) ai[k++] = i; else k++; } - for(int k2 = l; k2 < 0; k2++) - if(abyte0[j++] != 0) - ai[k++] = i; - else - k++; + for (int k2 = l; k2 < 0; k2++) + if (abyte0[j++] != 0) + ai[k++] = i; + else + k++; k += j1; j += k1; } } - private void method394(int i, int j, byte abyte0[], int k, int l, int i1, - int j1) { - int k1 = j + l * width; - int l1 = width - k; - int i2 = 0; - int j2 = 0; - if (l < topY) { - int k2 = topY - l; - i1 -= k2; - l = topY; - j2 += k2 * k; - k1 += k2 * width; - } - if (l + i1 >= bottomY) - i1 -= ((l + i1) - bottomY); - if (j < leftX) { - int l2 = leftX - j; - k -= l2; - j = leftX; - j2 += l2; - k1 += l2; - i2 += l2; - l1 += l2; - } - if (j + k >= bottomX) { - int i3 = ((j + k) - bottomX); - k -= i3; - i2 += i3; - l1 += i3; - } - if (k <= 0 || i1 <= 0) - return; - method395(abyte0, i1, k1, pixels, j2, k, i2, l1, j1, i); - } + private void method394(int i, int j, byte abyte0[], int k, int l, int i1, int j1) { + int k1 = j + l * width; + int l1 = width - k; + int i2 = 0; + int j2 = 0; + if (l < topY) { + int k2 = topY - l; + i1 -= k2; + l = topY; + j2 += k2 * k; + k1 += k2 * width; + } + if (l + i1 >= bottomY) + i1 -= ((l + i1) - bottomY); + if (j < leftX) { + int l2 = leftX - j; + k -= l2; + j = leftX; + j2 += l2; + k1 += l2; + i2 += l2; + l1 += l2; + } + if (j + k >= bottomX) { + int i3 = ((j + k) - bottomX); + k -= i3; + i2 += i3; + l1 += i3; + } + if (k <= 0 || i1 <= 0) + return; + method395(abyte0, i1, k1, pixels, j2, k, i2, l1, j1, i); + } private void method395(byte abyte0[], int i, int j, int ai[], int l, int i1, int j1, int k1, int l1, int i2) { l1 = ((l1 & 0xff00ff) * i2 & 0xff00ff00) + ((l1 & 0xff00) * i2 & 0xff0000) >> 8; i2 = 256 - i2; - for(int j2 = -i; j2 < 0; j2++) { - for(int k2 = -i1; k2 < 0; k2++) - if(abyte0[l++] != 0) { - int l2 = ai[j]; - ai[j++] = (((l2 & 0xff00ff) * i2 & 0xff00ff00) + ((l2 & 0xff00) * i2 & 0xff0000) >> 8) + l1; - } else { - j++; - } - j += k1; - l += j1; + for (int j2 = -i; j2 < 0; j2++) { + for (int k2 = -i1; k2 < 0; k2++) + if (abyte0[l++] != 0) { + int l2 = ai[j]; + ai[j++] = (((l2 & 0xff00ff) * i2 & 0xff00ff00) + ((l2 & 0xff00) * i2 & 0xff0000) >> 8) + l1; + } else { + j++; + } + j += k1; + l += j1; } } @@ -375,7 +385,7 @@ private void method395(byte abyte0[], int i, int j, int ai[], int l, int i1, int public int[] anIntArray1494; public int[] anIntArray1495; public int[] anIntArray1496; - public int verticalSpace; + public int verticalSpace; public Random aRandom1498; public boolean aBoolean1499; } diff --git a/Elvarg - Client/src/com/runescape/cache/graphics/IndexedImage.java b/Elvarg - Client/src/com/runescape/cache/graphics/IndexedImage.java index 1aa32cf..87ab424 100644 --- a/Elvarg - Client/src/com/runescape/cache/graphics/IndexedImage.java +++ b/Elvarg - Client/src/com/runescape/cache/graphics/IndexedImage.java @@ -1,53 +1,54 @@ package com.runescape.cache.graphics; + import com.runescape.cache.FileArchive; import com.runescape.draw.Rasterizer2D; import com.runescape.io.Buffer; public final class IndexedImage extends Rasterizer2D { - + public byte palettePixels[]; public final int[] palette; public int width; public int height; public int drawOffsetX; public int drawOffsetY; - public int resizeWidth; + public int resizeWidth; private int resizeHeight; - public IndexedImage(FileArchive archive, String s, int i) { + public IndexedImage(FileArchive archive, String s, int i) { Buffer image = new Buffer(archive.readFile(s + ".dat")); - Buffer meta = new Buffer(archive.readFile("index.dat")); + Buffer meta = new Buffer(archive.readFile("index.dat")); meta.currentPosition = image.readUShort(); resizeWidth = meta.readUShort(); resizeHeight = meta.readUShort(); - - int colorLength = meta.readUnsignedByte(); + + int colorLength = meta.readUnsignedByte(); palette = new int[colorLength]; - - for(int index = 0; index < colorLength - 1; index++) { - palette[index + 1] = meta.readTriByte(); + + for (int index = 0; index < colorLength - 1; index++) { + palette[index + 1] = meta.readTriByte(); } - - for(int l = 0; l < i; l++) { + + for (int l = 0; l < i; l++) { meta.currentPosition += 2; image.currentPosition += meta.readUShort() * meta.readUShort(); meta.currentPosition++; } - drawOffsetX = meta.readUnsignedByte(); - drawOffsetY = meta.readUnsignedByte(); + drawOffsetX = meta.readUnsignedByte(); + drawOffsetY = meta.readUnsignedByte(); width = meta.readUShort(); - height = meta.readUShort(); - int type = meta.readUnsignedByte(); - int pixels = width * height; + height = meta.readUShort(); + int type = meta.readUnsignedByte(); + int pixels = width * height; palettePixels = new byte[pixels]; - - if(type == 0) { - for(int index = 0; index < pixels; index++) { + + if (type == 0) { + for (int index = 0; index < pixels; index++) { palettePixels[index] = image.readSignedByte(); } - } else if(type == 1) { - for(int x = 0; x < width; x++) { - for(int y = 0; y < height; y++) { + } else if (type == 1) { + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { palettePixels[x + y * width] = image.readSignedByte(); } } @@ -57,11 +58,11 @@ public IndexedImage(FileArchive archive, String s, int i) { public void downscale() { resizeWidth /= 2; resizeHeight /= 2; - byte raster[] = new byte[resizeWidth * resizeHeight]; - int sourceIndex = 0; - for(int y = 0; y < height; y ++) { - for(int x = 0; x < width; x++) { - raster[(x + drawOffsetX >> 1) + (y + drawOffsetY >> 1) * resizeWidth] = raster[sourceIndex++]; + byte raster[] = new byte[resizeWidth * resizeHeight]; + int sourceIndex = 0; + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + raster[(x + drawOffsetX >> 1) + (y + drawOffsetY >> 1) * resizeWidth] = raster[sourceIndex++]; } } this.palettePixels = raster; @@ -72,15 +73,15 @@ public void downscale() { } public void resize() { - if(width == resizeWidth && height == resizeHeight) { + if (width == resizeWidth && height == resizeHeight) { return; } - + byte raster[] = new byte[resizeWidth * resizeHeight]; - + int i = 0; - for(int y = 0; y < height; y++) { - for(int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { raster[x + drawOffsetX + (y + drawOffsetY) * resizeWidth] = raster[i++]; } } @@ -92,10 +93,10 @@ public void resize() { } public void flipHorizontally() { - byte raster[] = new byte[width * height]; - int pixel = 0; - for(int y = 0; y < height; y++) { - for(int x = width - 1; x >= 0; x--) { + byte raster[] = new byte[width * height]; + int pixel = 0; + for (int y = 0; y < height; y++) { + for (int x = width - 1; x >= 0; x--) { raster[pixel++] = raster[x + y * width]; } } @@ -104,10 +105,10 @@ public void flipHorizontally() { } public void flipVertically() { - byte raster[] = new byte[width * height]; - int pixel = 0; - for(int y = height - 1; y >= 0; y--) { - for(int x = 0; x < width; x++) { + byte raster[] = new byte[width * height]; + int pixel = 0; + for (int y = height - 1; y >= 0; y--) { + for (int x = 0; x < width; x++) { raster[pixel++] = raster[x + y * width]; } } @@ -115,61 +116,61 @@ public void flipVertically() { drawOffsetY = resizeHeight - height - drawOffsetY; } - public void offsetColor(int redOffset, int greenOffset, int blueOffset) { - for(int index = 0; index < palette.length; index++) { - int red = palette[index] >> 16 & 0xff; + public void offsetColor(int redOffset, int greenOffset, int blueOffset) { + for (int index = 0; index < palette.length; index++) { + int red = palette[index] >> 16 & 0xff; red += redOffset; - - if(red < 0) { + + if (red < 0) { red = 0; - } else if(red > 255) { + } else if (red > 255) { red = 255; } - + int green = palette[index] >> 8 & 0xff; - - green += greenOffset; - if(green < 0) { + + green += greenOffset; + if (green < 0) { green = 0; - } else if(green > 255) { + } else if (green > 255) { green = 255; } - + int blue = palette[index] & 0xff; - - blue += blueOffset; - if(blue < 0) { + + blue += blueOffset; + if (blue < 0) { blue = 0; - } else if(blue > 255) { + } else if (blue > 255) { blue = 255; } palette[index] = (red << 16) + (green << 8) + blue; } } - public void draw(int x, int y) { + public void draw(int x, int y) { x += drawOffsetX; - y += drawOffsetY; - int destOffset = x + y * Rasterizer2D.width; + y += drawOffsetY; + int destOffset = x + y * Rasterizer2D.width; int sourceOffset = 0; int height = this.height; - int width = this.width; - int destStep = Rasterizer2D.width - width; + int width = this.width; + int destStep = Rasterizer2D.width - width; int sourceStep = 0; - - if(y < Rasterizer2D.topY) { - int dy = Rasterizer2D.topY - y; - height -= dy; + + if (y < Rasterizer2D.topY) { + int dy = Rasterizer2D.topY - y; + height -= dy; y = Rasterizer2D.topY; - sourceOffset += dy * width; + sourceOffset += dy * width; destOffset += dy * Rasterizer2D.width; } - - if(y + height > Rasterizer2D.bottomY) { + + if (y + height > Rasterizer2D.bottomY) { height -= (y + height) - Rasterizer2D.bottomY; } - - if(x < Rasterizer2D.leftX) { + + if (x < Rasterizer2D.leftX) { int k2 = Rasterizer2D.leftX - x; width -= k2; x = Rasterizer2D.leftX; @@ -178,62 +179,64 @@ public void draw(int x, int y) { sourceStep += k2; destStep += k2; } - - if(x + width > Rasterizer2D.bottomX) { - int dx = (x + width) - Rasterizer2D.bottomX; + + if (x + width > Rasterizer2D.bottomX) { + int dx = (x + width) - Rasterizer2D.bottomX; width -= dx; sourceStep += dx; destStep += dx; } - - if(!(width <= 0 || height <= 0)) { - draw(height, Rasterizer2D.pixels, palettePixels, destStep, destOffset, width, sourceOffset, palette, sourceStep); + + if (!(width <= 0 || height <= 0)) { + draw(height, Rasterizer2D.pixels, palettePixels, destStep, destOffset, width, sourceOffset, palette, + sourceStep); } - + } - private void draw(int i, int raster[], byte image[], int destStep, int destIndex, int width, int sourceIndex, int ai1[], int sourceStep) { - int minX = -(width >> 2); - width = -(width & 3); - for(int y = -i; y < 0; y++) { - for(int x = minX; x < 0; x++) { - + private void draw(int i, int raster[], byte image[], int destStep, int destIndex, int width, int sourceIndex, + int ai1[], int sourceStep) { + int minX = -(width >> 2); + width = -(width & 3); + for (int y = -i; y < 0; y++) { + for (int x = minX; x < 0; x++) { + byte pixel = image[sourceIndex++]; - - if(pixel != 0) { - raster[destIndex++] = ai1[pixel & 0xff]; + + if (pixel != 0) { + raster[destIndex++] = ai1[pixel & 0xff]; } else { - destIndex++; + destIndex++; } pixel = image[sourceIndex++]; - if(pixel != 0) { + if (pixel != 0) { raster[destIndex++] = ai1[pixel & 0xff]; } else { destIndex++; } - pixel = image[sourceIndex++]; - if(pixel != 0) { + pixel = image[sourceIndex++]; + if (pixel != 0) { raster[destIndex++] = ai1[pixel & 0xff]; } else { destIndex++; } pixel = image[sourceIndex++]; - if(pixel != 0) { + if (pixel != 0) { raster[destIndex++] = ai1[pixel & 0xff]; } else { destIndex++; } } - for(int x = width; x < 0; x++) { - byte pixel = image[sourceIndex++]; - if(pixel != 0) { + for (int x = width; x < 0; x++) { + byte pixel = image[sourceIndex++]; + if (pixel != 0) { raster[destIndex++] = ai1[pixel & 0xff]; } else { destIndex++; } } - destIndex += destStep; - sourceIndex += sourceStep; + destIndex += destStep; + sourceIndex += sourceStep; } } } \ No newline at end of file diff --git a/Elvarg - Client/src/com/runescape/cache/graphics/Sprite.java b/Elvarg - Client/src/com/runescape/cache/graphics/Sprite.java index 7cb236b..592d41a 100644 --- a/Elvarg - Client/src/com/runescape/cache/graphics/Sprite.java +++ b/Elvarg - Client/src/com/runescape/cache/graphics/Sprite.java @@ -1,5 +1,9 @@ package com.runescape.cache.graphics; -import java.awt.*; + +import java.awt.Component; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Toolkit; import java.awt.image.PixelGrabber; import javax.swing.ImageIcon; @@ -21,10 +25,9 @@ public Sprite(int i, int j) { drawOffsetX = drawOffsetY = 0; } - public Sprite(byte data[], Component component) { try { - this.image = Toolkit.getDefaultToolkit().createImage(data); + this.image = Toolkit.getDefaultToolkit().createImage(data); MediaTracker mediatracker = new MediaTracker(component); mediatracker.addImage(image, 0); mediatracker.waitForAll(); @@ -44,7 +47,7 @@ public Sprite(byte data[], Component component) { public Sprite(String img, int width, int height) { try { - this.image = Toolkit.getDefaultToolkit().createImage(FileUtils.readFile(img)); + this.image = Toolkit.getDefaultToolkit().createImage(FileUtils.readFile(img)); myWidth = width; myHeight = height; maxWidth = myWidth; @@ -59,7 +62,7 @@ public Sprite(String img, int width, int height) { System.out.println(_ex); } } - + public Sprite(Sprite img, int width, int height) { try { Image image = img.image; @@ -80,7 +83,7 @@ public Sprite(Sprite img, int width, int height) { public Sprite(String img) { try { - this.image = Toolkit.getDefaultToolkit().getImage(SignLink.findcachedir() + "Sprites/" + img + ".png"); + this.image = Toolkit.getDefaultToolkit().getImage(SignLink.findcachedir() + "Sprites/" + img + ".png"); ImageIcon sprite = new ImageIcon(image); myWidth = sprite.getIconWidth(); myHeight = sprite.getIconHeight(); @@ -100,7 +103,7 @@ public Sprite(String img) { public void drawHoverSprite(int x, int y, int offsetX, int offsetY, Sprite hover) { this.drawSprite(x, y); - if (Client.instance.mouseX >= offsetX + x && Client.instance.mouseX <= offsetX + x + this.myWidth + if (Client.instance.mouseX >= offsetX + x && Client.instance.mouseX <= offsetX + x + this.myWidth && Client.instance.mouseY >= offsetY + y && Client.instance.mouseY <= offsetY + y + this.myHeight) { hover.drawSprite(x, y); } @@ -142,7 +145,8 @@ public void draw24BitSprite(int x, int y) { destStep += trimRight; } if (!((width <= 0) || (height <= 0))) { - set24BitPixels(width, height, Rasterizer2D.pixels, myPixels, alpha, destOffset, srcOffset, destStep, srcStep); + set24BitPixels(width, height, Rasterizer2D.pixels, myPixels, alpha, destOffset, srcOffset, destStep, + srcStep); } } @@ -185,7 +189,8 @@ public void drawTransparentSprite(int x, int y, int opacity) { } } - private void set24BitPixels(int width, int height, int destPixels[], int srcPixels[], int srcAlpha, int destOffset, int srcOffset, int destStep, int srcStep) { + private void set24BitPixels(int width, int height, int destPixels[], int srcPixels[], int srcAlpha, int destOffset, + int srcOffset, int destStep, int srcStep) { int srcColor; int destAlpha; for (int loop = -height; loop < 0; loop++) { @@ -195,7 +200,9 @@ private void set24BitPixels(int width, int height, int destPixels[], int srcPixe srcColor = srcPixels[srcOffset++]; if (srcColor != 0 && srcColor != 0xffffff) { int destColor = destPixels[destOffset]; - destPixels[destOffset++] = ((srcColor & 0xff00ff) * srcAlpha + (destColor & 0xff00ff) * destAlpha & 0xff00ff00) + ((srcColor & 0xff00) * srcAlpha + (destColor & 0xff00) * destAlpha & 0xff0000) >> 8; + destPixels[destOffset++] = ((srcColor & 0xff00ff) * srcAlpha + (destColor & 0xff00ff) * destAlpha + & 0xff00ff00) + + ((srcColor & 0xff00) * srcAlpha + (destColor & 0xff00) * destAlpha & 0xff0000) >> 8; } else { destOffset++; } @@ -207,28 +214,29 @@ private void set24BitPixels(int width, int height, int destPixels[], int srcPixe public void setTransparency(int transRed, int transGreen, int transBlue) { for (int index = 0; index < myPixels.length; index++) - if (((myPixels[index] >> 16) & 255) == transRed && ((myPixels[index] >> 8) & 255) == transGreen && (myPixels[index] & 255) == transBlue) + if (((myPixels[index] >> 16) & 255) == transRed && ((myPixels[index] >> 8) & 255) == transGreen + && (myPixels[index] & 255) == transBlue) myPixels[index] = 0; } - public Sprite(FileArchive archive, String name, int i) { - Buffer dataBuffer = new Buffer(archive.readFile(name + ".dat")); + public Sprite(FileArchive archive, String name, int i) { + Buffer dataBuffer = new Buffer(archive.readFile(name + ".dat")); Buffer indexBuffer = new Buffer(archive.readFile("index.dat")); - + indexBuffer.currentPosition = dataBuffer.readUShort(); - + maxWidth = indexBuffer.readUShort(); maxHeight = indexBuffer.readUShort(); - int pixelCount = indexBuffer.readUnsignedByte(); + int pixelCount = indexBuffer.readUnsignedByte(); int raster[] = new int[pixelCount]; - - for (int pixel = 0; pixel < pixelCount - 1; pixel++) { + + for (int pixel = 0; pixel < pixelCount - 1; pixel++) { raster[pixel + 1] = indexBuffer.readTriByte(); if (raster[pixel + 1] == 0) raster[pixel + 1] = 1; } - for (int index = 0; index < i; index++) { + for (int index = 0; index < i; index++) { indexBuffer.currentPosition += 2; dataBuffer.currentPosition += indexBuffer.readUShort() * indexBuffer.readUShort(); indexBuffer.currentPosition++; @@ -238,11 +246,11 @@ public Sprite(FileArchive archive, String name, int i) { drawOffsetY = indexBuffer.readUnsignedByte(); myWidth = indexBuffer.readUShort(); myHeight = indexBuffer.readUShort(); - + int type = indexBuffer.readUnsignedByte(); - + int spriteSize = myWidth * myHeight; - + myPixels = new int[spriteSize]; if (type == 0) { for (int pixel = 0; pixel < spriteSize; pixel++) { @@ -252,7 +260,7 @@ public Sprite(FileArchive archive, String name, int i) { return; } if (type == 1) { - for (int x = 0; x < myWidth; x++) { + for (int x = 0; x < myWidth; x++) { for (int y = 0; y < myHeight; y++) { myPixels[x + y * myWidth] = raster[dataBuffer.readUnsignedByte()]; } @@ -364,11 +372,11 @@ private void method347(int i, int j, int k, int l, int i1, int k1, int ai[], int i1 += l; } } - + public void drawSprite1(int i, int j) { - drawSprite1(i, j, 128); + drawSprite1(i, j, 128); } - + public void drawSprite1(int i, int j, int k, boolean overrideCanvas) { i += drawOffsetX; j += drawOffsetY; @@ -445,8 +453,7 @@ public void drawSprite1(int i, int j, int k) { } } - public void drawSprite(int x, int y) - { + public void drawSprite(int x, int y) { x += drawOffsetX; y += drawOffsetY; int rasterClip = x + y * Rasterizer2D.width; @@ -455,18 +462,16 @@ public void drawSprite(int x, int y) int width = myWidth; int rasterOffset = Rasterizer2D.width - width; int imageOffset = 0; - if(y < Rasterizer2D.topY) - { + if (y < Rasterizer2D.topY) { int dy = Rasterizer2D.topY - y; height -= dy; y = Rasterizer2D.topY; imageClip += dy * width; rasterClip += dy * Rasterizer2D.width; } - if(y + height > Rasterizer2D.bottomY) + if (y + height > Rasterizer2D.bottomY) height -= (y + height) - Rasterizer2D.bottomY; - if(x < Rasterizer2D.leftX) - { + if (x < Rasterizer2D.leftX) { int dx = Rasterizer2D.leftX - x; width -= dx; x = Rasterizer2D.leftX; @@ -475,15 +480,13 @@ public void drawSprite(int x, int y) imageOffset += dx; rasterOffset += dx; } - if(x + width > Rasterizer2D.bottomX) - { + if (x + width > Rasterizer2D.bottomX) { int dx = (x + width) - Rasterizer2D.bottomX; width -= dx; imageOffset += dx; rasterOffset += dx; } - if(!(width <= 0 || height <= 0)) - { + if (!(width <= 0 || height <= 0)) { method349(Rasterizer2D.pixels, myPixels, imageClip, rasterClip, width, height, rasterOffset, imageOffset); } } @@ -501,16 +504,20 @@ public void drawSprite(int i, int k, int color) { for (int x = 0; x < tempWidth; x++) { for (int y = 0; y < tempHeight; y++) { if (tempArray[(x) + (y) * tempWidth] == 0) { - if (x < tempWidth - 1 && tempArray[(x + 1) + ((y) * tempWidth)] > 0 && tempArray[(x + 1) + ((y) * tempWidth)] != 0xffffff) { + if (x < tempWidth - 1 && tempArray[(x + 1) + ((y) * tempWidth)] > 0 + && tempArray[(x + 1) + ((y) * tempWidth)] != 0xffffff) { tempArray[(x) + (y) * tempWidth] = color; } - if (x > 0 && tempArray[(x - 1) + ((y) * tempWidth)] > 0 && tempArray[(x - 1) + ((y) * tempWidth)] != 0xffffff) { + if (x > 0 && tempArray[(x - 1) + ((y) * tempWidth)] > 0 + && tempArray[(x - 1) + ((y) * tempWidth)] != 0xffffff) { tempArray[(x) + (y) * tempWidth] = color; } - if (y < tempHeight - 1 && tempArray[(x) + ((y + 1) * tempWidth)] > 0 && tempArray[(x) + ((y + 1) * tempWidth)] != 0xffffff) { + if (y < tempHeight - 1 && tempArray[(x) + ((y + 1) * tempWidth)] > 0 + && tempArray[(x) + ((y + 1) * tempWidth)] != 0xffffff) { tempArray[(x) + (y) * tempWidth] = color; } - if (y > 0 && tempArray[(x) + ((y - 1) * tempWidth)] > 0 && tempArray[(x) + ((y - 1) * tempWidth)] != 0xffffff) { + if (y > 0 && tempArray[(x) + ((y - 1) * tempWidth)] > 0 + && tempArray[(x) + ((y - 1) * tempWidth)] != 0xffffff) { tempArray[(x) + (y) * tempWidth] = color; } } @@ -648,7 +655,8 @@ private void method351(int i, int j, int ai[], int ai1[], int l, int i1, int j1, k = ai1[i++]; if (k != 0) { int i3 = ai[l1]; - ai[l1++] = ((k & 0xff00ff) * k1 + (i3 & 0xff00ff) * j2 & 0xff00ff00) + ((k & 0xff00) * k1 + (i3 & 0xff00) * j2 & 0xff0000) >> 8; + ai[l1++] = ((k & 0xff00ff) * k1 + (i3 & 0xff00ff) * j2 & 0xff00ff00) + + ((k & 0xff00) * k1 + (i3 & 0xff00) * j2 & 0xff0000) >> 8; } else { l1++; } @@ -663,8 +671,8 @@ public void rotate(int i, int j, int ai[], int k, int ai1[], int i1, int j1, int try { int j2 = -l1 / 2; int k2 = -i / 2; - int l2 = (int) (Math.sin((double) j / 326.11000000000001D) * 65536D); - int i3 = (int) (Math.cos((double) j / 326.11000000000001D) * 65536D); + int l2 = (int) (Math.sin(j / 326.11000000000001D) * 65536D); + int i3 = (int) (Math.cos(j / 326.11000000000001D) * 65536D); l2 = l2 * k >> 8; i3 = i3 * k >> 8; int j3 = (i2 << 16) + (k2 * l2 + j2 * i3); @@ -677,25 +685,27 @@ public void rotate(int i, int j, int ai[], int k, int ai1[], int i1, int j1, int int l4 = k3 - l2 * i4; for (k1 = -ai[j1]; k1 < 0; k1++) { int x1 = k4 >> 16; - int y1 = l4 >> 16; - int x2 = x1 + 1; - int y2 = y1 + 1; - int c1 = myPixels[x1 + y1 * myWidth]; - int c2 = myPixels[x2 + y1 * myWidth]; - int c3 = myPixels[x1 + y2 * myWidth]; - int c4 = myPixels[x2 + y2 * myWidth]; - int u1 = (k4 >> 8) - (x1 << 8); - int v1 = (l4 >> 8) - (y1 << 8); - int u2 = (x2 << 8) - (k4 >> 8); - int v2 = (y2 << 8) - (l4 >> 8); - int a1 = u2 * v2; - int a2 = u1 * v2; - int a3 = u2 * v1; - int a4 = u1 * v1; - int r = (c1 >> 16 & 0xff) * a1 + (c2 >> 16 & 0xff) * a2 + (c3 >> 16 & 0xff) * a3 + (c4 >> 16 & 0xff) * a4 & 0xff0000; - int g = (c1 >> 8 & 0xff) * a1 + (c2 >> 8 & 0xff) * a2 + (c3 >> 8 & 0xff) * a3 + (c4 >> 8 & 0xff) * a4 >> 8 & 0xff00; - int b = (c1 & 0xff) * a1 + (c2 & 0xff) * a2 + (c3 & 0xff) * a3 + (c4 & 0xff) * a4 >> 16; - Rasterizer2D.pixels[j4++] = r | g | b; + int y1 = l4 >> 16; + int x2 = x1 + 1; + int y2 = y1 + 1; + int c1 = myPixels[x1 + y1 * myWidth]; + int c2 = myPixels[x2 + y1 * myWidth]; + int c3 = myPixels[x1 + y2 * myWidth]; + int c4 = myPixels[x2 + y2 * myWidth]; + int u1 = (k4 >> 8) - (x1 << 8); + int v1 = (l4 >> 8) - (y1 << 8); + int u2 = (x2 << 8) - (k4 >> 8); + int v2 = (y2 << 8) - (l4 >> 8); + int a1 = u2 * v2; + int a2 = u1 * v2; + int a3 = u2 * v1; + int a4 = u1 * v1; + int r = (c1 >> 16 & 0xff) * a1 + (c2 >> 16 & 0xff) * a2 + (c3 >> 16 & 0xff) * a3 + + (c4 >> 16 & 0xff) * a4 & 0xff0000; + int g = (c1 >> 8 & 0xff) * a1 + (c2 >> 8 & 0xff) * a2 + (c3 >> 8 & 0xff) * a3 + + (c4 >> 8 & 0xff) * a4 >> 8 & 0xff00; + int b = (c1 & 0xff) * a1 + (c2 & 0xff) * a2 + (c3 & 0xff) * a3 + (c4 & 0xff) * a4 >> 16; + Rasterizer2D.pixels[j4++] = r | g | b; k4 += i3; l4 -= l2; } @@ -752,7 +762,7 @@ public void method353(int i, double d, int l1) { public Sprite(byte spriteData[]) { try { - this.image = Toolkit.getDefaultToolkit().createImage(spriteData); + this.image = Toolkit.getDefaultToolkit().createImage(spriteData); ImageIcon sprite = new ImageIcon(image); myWidth = sprite.getIconWidth(); myHeight = sprite.getIconHeight(); @@ -807,7 +817,7 @@ public void method354(IndexedImage background, int i, int j) { method355(myPixels, j1, background.palettePixels, i1, Rasterizer2D.pixels, 0, k1, k, l1, l); } } - + public void drawAdvancedSprite(int xPos, int yPos) { drawAdvancedSprite(xPos, yPos, 256); } @@ -831,7 +841,7 @@ public void drawAdvancedSprite(int xPos, int yPos, int alpha) { } if (yPos + spriteHeight > Rasterizer2D.bottomY) spriteHeight -= (yPos + spriteHeight) - Rasterizer2D.bottomY; - if (xPos < Rasterizer2D.leftX) { + if (xPos < Rasterizer2D.leftX) { int l2 = Rasterizer2D.leftX - xPos; spriteWidth -= l2; xPos = Rasterizer2D.leftX; @@ -851,33 +861,36 @@ public void drawAdvancedSprite(int xPos, int yPos, int alpha) { } } - private void renderARGBPixels(int spriteWidth, int spriteHeight, int spritePixels[], int renderAreaPixels[], int pixel, int alphaValue, int i, int l, int j1) { - int pixelColor; - int alphaLevel; - int alpha = alphaValue; - for (int height = -spriteHeight; height < 0; height++) { - for (int width = -spriteWidth; width < 0; width++) { - alphaValue = ((myPixels[i] >> 24) & (alpha - 1)); - alphaLevel = 256 - alphaValue; - if (alphaLevel > 256) { - alphaValue = 0; - } - if (alpha == 0) { - alphaLevel = 256; - alphaValue = 0; - } - pixelColor = spritePixels[i++]; - if (pixelColor != 0) { - int pixelValue = renderAreaPixels[pixel]; - renderAreaPixels[pixel++] = ((pixelColor & 0xff00ff) * alphaValue + (pixelValue & 0xff00ff) * alphaLevel & 0xff00ff00) + ((pixelColor & 0xff00) * alphaValue + (pixelValue & 0xff00) * alphaLevel & 0xff0000) >> 8; - } else { - pixel++; - } - } - pixel += j1; - i += l; - } - } + private void renderARGBPixels(int spriteWidth, int spriteHeight, int spritePixels[], int renderAreaPixels[], + int pixel, int alphaValue, int i, int l, int j1) { + int pixelColor; + int alphaLevel; + int alpha = alphaValue; + for (int height = -spriteHeight; height < 0; height++) { + for (int width = -spriteWidth; width < 0; width++) { + alphaValue = ((myPixels[i] >> 24) & (alpha - 1)); + alphaLevel = 256 - alphaValue; + if (alphaLevel > 256) { + alphaValue = 0; + } + if (alpha == 0) { + alphaLevel = 256; + alphaValue = 0; + } + pixelColor = spritePixels[i++]; + if (pixelColor != 0) { + int pixelValue = renderAreaPixels[pixel]; + renderAreaPixels[pixel++] = ((pixelColor & 0xff00ff) * alphaValue + + (pixelValue & 0xff00ff) * alphaLevel & 0xff00ff00) + + ((pixelColor & 0xff00) * alphaValue + (pixelValue & 0xff00) * alphaLevel & 0xff0000) >> 8; + } else { + pixel++; + } + } + pixel += j1; + i += l; + } + } private void method355(int ai[], int i, byte abyte0[], int j, int ai1[], int k, int l, int i1, int j1, int k1) { int l1 = -(i >> 2); diff --git a/Elvarg - Client/src/com/runescape/cache/graphics/SpriteLoader.java b/Elvarg - Client/src/com/runescape/cache/graphics/SpriteLoader.java index 0ea2bbd..78e4525 100644 --- a/Elvarg - Client/src/com/runescape/cache/graphics/SpriteLoader.java +++ b/Elvarg - Client/src/com/runescape/cache/graphics/SpriteLoader.java @@ -2,7 +2,6 @@ import java.io.ByteArrayInputStream; import java.io.DataInputStream; -import java.io.File; import java.io.IOException; import java.util.logging.Logger; import java.util.zip.GZIPInputStream; @@ -13,119 +12,114 @@ import com.runescape.sign.SignLink; import com.runescape.util.LoggerUtils; - public final class SpriteLoader { - private static final Logger LOGGER = LoggerUtils.getLogger(SpriteLoader.class); - - public static SpriteLoader[] cache; - private static Sprite[] sprites = null; - public static int totalSprites; - public String name; - public int id; - public int drawOffsetX; - public int drawOffsetY; - public byte[] spriteData; - - public SpriteLoader() { - name = "Unknown"; - id = -1; - drawOffsetX = 0; - drawOffsetY = 0; - spriteData = null; - } - - public static void loadSprites() { - try { - - - Buffer index = new Buffer(FileUtils - .readFile(SignLink.findcachedir() + "sprites.idx")); - Buffer data = new Buffer(FileUtils - .readFile(SignLink.findcachedir() + "sprites.dat")); - - DataInputStream indexFile = new DataInputStream( - new GZIPInputStream(new ByteArrayInputStream(index.payload))); - DataInputStream dataFile = new DataInputStream( - new GZIPInputStream(new ByteArrayInputStream(data.payload))); - - - int totalSprites = indexFile.readInt(); - LOGGER.info("Sprites Loaded: " + totalSprites); - if (cache == null) { - cache = new SpriteLoader[totalSprites]; - sprites = new Sprite[totalSprites]; - } - for (int i = 0; i < totalSprites; i++) { - int id = indexFile.readInt(); - if (cache[id] == null) { - cache[id] = new SpriteLoader(); - } - cache[id].readValues(indexFile, dataFile); - createSprite(cache[id]); - } - indexFile.close(); - dataFile.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void readValues(DataInputStream index, DataInputStream data) throws IOException { - do { - int opCode = data.readByte(); - if (opCode == 0) { - break; - } - if (opCode == 1) { - id = data.readShort(); - } else if (opCode == 2) { - name = data.readUTF(); - } else if (opCode == 3) { - drawOffsetX = data.readShort(); - } else if (opCode == 4) { - drawOffsetY = data.readShort(); - } else if (opCode == 5) { - int indexLength = index.readInt(); - byte[] dataread = new byte[indexLength]; - data.readFully(dataread); - spriteData = dataread; - } - } while (true); - } - - public static void createSprite(SpriteLoader sprite) { - - - /*File directory = new File("./Cache/dump"); if - (!directory.exists()) { directory.mkdir(); } FileUtils.writeFile(new File(directory.getAbsolutePath() + - System.getProperty("file.separator") + sprite.id + ".png"), - sprite.spriteData); - */ - - sprites[sprite.id] = new Sprite(sprite.spriteData); - sprites[sprite.id].drawOffsetX = sprite.drawOffsetX; - sprites[sprite.id].drawOffsetY = sprite.drawOffsetY; - } - - public static String getName(int index) { - if (cache[index].name != null) { - return cache[index].name; - } else { - return "null"; - } - } - - public static int getOffsetX(int index) { - return cache[index].drawOffsetX; - } - - public static int getOffsetY(int index) { - return cache[index].drawOffsetY; - } - - public static Sprite[] getSprites() { - return sprites; - } + private static final Logger LOGGER = LoggerUtils.getLogger(SpriteLoader.class); + + public static SpriteLoader[] cache; + private static Sprite[] sprites = null; + public static int totalSprites; + public String name; + public int id; + public int drawOffsetX; + public int drawOffsetY; + public byte[] spriteData; + + public SpriteLoader() { + name = "Unknown"; + id = -1; + drawOffsetX = 0; + drawOffsetY = 0; + spriteData = null; + } + + public static void loadSprites() { + try { + + Buffer index = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "sprites.idx")); + Buffer data = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "sprites.dat")); + + DataInputStream indexFile = new DataInputStream( + new GZIPInputStream(new ByteArrayInputStream(index.payload))); + DataInputStream dataFile = new DataInputStream(new GZIPInputStream(new ByteArrayInputStream(data.payload))); + + int totalSprites = indexFile.readInt(); + LOGGER.info("Sprites Loaded: " + totalSprites); + if (cache == null) { + cache = new SpriteLoader[totalSprites]; + sprites = new Sprite[totalSprites]; + } + for (int i = 0; i < totalSprites; i++) { + int id = indexFile.readInt(); + if (cache[id] == null) { + cache[id] = new SpriteLoader(); + } + cache[id].readValues(indexFile, dataFile); + createSprite(cache[id]); + } + indexFile.close(); + dataFile.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void readValues(DataInputStream index, DataInputStream data) throws IOException { + do { + int opCode = data.readByte(); + if (opCode == 0) { + break; + } + if (opCode == 1) { + id = data.readShort(); + } else if (opCode == 2) { + name = data.readUTF(); + } else if (opCode == 3) { + drawOffsetX = data.readShort(); + } else if (opCode == 4) { + drawOffsetY = data.readShort(); + } else if (opCode == 5) { + int indexLength = index.readInt(); + byte[] dataread = new byte[indexLength]; + data.readFully(dataread); + spriteData = dataread; + } + } while (true); + } + + public static void createSprite(SpriteLoader sprite) { + + /* + * File directory = new File("./Cache/dump"); if (!directory.exists()) { + * directory.mkdir(); } FileUtils.writeFile(new + * File(directory.getAbsolutePath() + + * System.getProperty("file.separator") + sprite.id + ".png"), + * sprite.spriteData); + */ + + sprites[sprite.id] = new Sprite(sprite.spriteData); + sprites[sprite.id].drawOffsetX = sprite.drawOffsetX; + sprites[sprite.id].drawOffsetY = sprite.drawOffsetY; + } + + public static String getName(int index) { + if (cache[index].name != null) { + return cache[index].name; + } else { + return "null"; + } + } + + public static int getOffsetX(int index) { + return cache[index].drawOffsetX; + } + + public static int getOffsetY(int index) { + return cache[index].drawOffsetY; + } + + public static Sprite[] getSprites() { + return sprites; + } } diff --git a/Elvarg - Client/src/com/runescape/cache/graphics/Widget.java b/Elvarg - Client/src/com/runescape/cache/graphics/Widget.java index 632a5ad..6597c64 100644 --- a/Elvarg - Client/src/com/runescape/cache/graphics/Widget.java +++ b/Elvarg - Client/src/com/runescape/cache/graphics/Widget.java @@ -33,26 +33,9 @@ public final class Widget { public static final int TYPE_MODEL = 6; public static final int TYPE_ITEM_LIST = 7; - private static final int[] SPECIAL_BARS = - { - 7474, - 7499, - 7549, - 7574, - 7599, - 7624, - 7649, - 7674, - 7699, - 7800, - 8493, - 6117, - 7524, - 7749, - 7724, - 12323, - }; - + private static final int[] SPECIAL_BARS = { 7474, 7499, 7549, 7574, 7599, 7624, 7649, 7674, 7699, 7800, 8493, 6117, + 7524, 7749, 7724, 12323, }; + public void swapInventoryItems(int i, int j) { int id = inventoryItemId[i]; inventoryItemId[i] = inventoryItemId[j]; @@ -118,21 +101,20 @@ public static void load(FileArchive interfaces, GameFont textDrawingAreas[], Fil widget.invisible = buffer.readUnsignedByte() == 1; int length = buffer.readUShort(); - if(widget.id == 5608) { + if (widget.id == 5608) { widget.children = new int[PRAYER_INTERFACE_CHILDREN]; widget.childX = new int[PRAYER_INTERFACE_CHILDREN]; widget.childY = new int[PRAYER_INTERFACE_CHILDREN]; for (int index = 0; index < length; index++) { - widget.children[BEGIN_READING_PRAYER_INTERFACE+ index] = buffer.readUShort(); - widget.childX[BEGIN_READING_PRAYER_INTERFACE+ index] = buffer.readShort(); - widget.childY[BEGIN_READING_PRAYER_INTERFACE+ index] = buffer.readShort(); + widget.children[BEGIN_READING_PRAYER_INTERFACE + index] = buffer.readUShort(); + widget.childX[BEGIN_READING_PRAYER_INTERFACE + index] = buffer.readShort(); + widget.childY[BEGIN_READING_PRAYER_INTERFACE + index] = buffer.readShort(); } } else { - widget.children = new int[length]; widget.childX = new int[length]; widget.childY = new int[length]; @@ -282,16 +264,13 @@ public static void load(FileArchive interfaces, GameFont textDrawingAreas[], Fil widget.spellName = buffer.readString(); widget.spellUsableOn = buffer.readUShort(); } - if (widget.type == 8) { widget.defaultText = buffer.readString(); } - if (widget.atActionType == OPTION_OK || widget.atActionType == OPTION_TOGGLE_SETTING || widget.atActionType == OPTION_RESET_SETTING || widget.atActionType == OPTION_CONTINUE) { widget.tooltip = buffer.readString(); if (widget.tooltip.length() == 0) { - // TODO if (widget.atActionType == OPTION_OK) widget.tooltip = "Ok"; if (widget.atActionType == OPTION_TOGGLE_SETTING) @@ -311,50 +290,39 @@ public static void load(FileArchive interfaces, GameFont textDrawingAreas[], Fil equipmentTab(textDrawingAreas); itemsKeptOnDeath(textDrawingAreas); bounty(textDrawingAreas); - repositionModernSpells(); shop(); prayerBook(); priceChecker(textDrawingAreas); - bankInterface(textDrawingAreas); bankSettings(textDrawingAreas); - - killFeed(textDrawingAreas); - teleportInterface(textDrawingAreas); - - mainTeleports(); - normalSpellbookEdit(textDrawingAreas); - ancientSpellbookEdit(textDrawingAreas); settingsTab(); - - //specialBars(); - spriteCache = null; } public static void settingsTab() { Widget p = addTabInterface(42500); - //Removing adjust bars such as music/sounds - int[] to_remove = {19131, 19149, 19157, 22635, 941, 942, 943, 944, 945, 19150, 19151, 19152, 19153, 19154, 19155}; - for(int i : to_remove) { + // Removing adjust bars such as music/sounds + int[] to_remove = { 19131, 19149, 19157, 22635, 941, 942, 943, 944, 945, 19150, 19151, 19152, 19153, 19154, + 19155 }; + for (int i : to_remove) { removeSomething(i); } - for(int i : new int[]{930, 931, 932, 933, 934, 22634}) { - interfaceCache[i].tooltip - = interfaceCache[i].defaultText = "Adjust Camera Zoom"; + for (int i : new int[] { 930, 931, 932, 933, 934, 22634 }) { + interfaceCache[i].tooltip = interfaceCache[i].defaultText = "Adjust Camera Zoom"; } - //Adding zoom image + // Adding zoom image addSpriteLoader(42508, 189); - //Adding key bindings image + // Adding key bindings image addSpriteLoader(42510, 190); - addButton(42511, 42500, 30, 30, interfaceCache[19156].disabledSprite, interfaceCache[19156].enabledSprite, -1, "Adjust Key bindings"); - removeSomething(19156); //Removes house button + addButton(42511, 42500, 30, 30, interfaceCache[19156].disabledSprite, interfaceCache[19156].enabledSprite, -1, + "Adjust Key bindings"); + removeSomething(19156); // Removes house button - //Adding screen sizes + // Adding screen sizes addButton(42501, 42500, 54, 46, 185, 186, 42502, "Fixed Screen"); addHoveredButton_sprite_loader(42502, 186, 54, 46, 42503); @@ -363,333 +331,26 @@ public static void settingsTab() { p.totalChildren(8); - //Screen sizes + // Screen sizes setBounds(42501, 30, 95, 0, p); setBounds(42502, 30, 95, 1, p); setBounds(42504, 110, 95, 2, p); setBounds(42505, 110, 95, 3, p); - //Camera zoom image + // Camera zoom image setBounds(42508, 10, 49, 4, p); - //key bindings images + // key bindings images setBounds(42511, 132, 212, 5, p); setBounds(42510, 136, 215, 6, p); - //Main settings interface + // Main settings interface setBounds(904, 0, 0, 7, p); } - public static void mainTeleports() { - addButton(39101, 38100, 79, 30, 1, 805, 174, 175, 39102, "Home Teleport"); - addHoveredButton_sprite_loader(39102, 175, 79, 30, 39103); - addButton(39104, 38100, 79, 30, 1, 806, 176, 177, 39105, "Other Teleports"); - addHoveredButton_sprite_loader(39105, 177, 79, 30, 39106); - } - - public static void ancientSpellbookEdit(GameFont[] t) { - Widget tab = addInterface(39100); - tab.totalChildren(36); - - //ADD "HOME" AND "OTHER" TELEPORTS - setBounds(39101, 10, 9, 0, tab); - setBounds(39102, 10, 9, 1, tab); - setBounds(39104, 105, 9, 2, tab); - setBounds(39105, 105, 9, 3, tab); - - //Row 1 - setBounds(12939, 25, 50, 4, tab); - setBounds(12987, 65, 50, 5, tab); - setBounds(12901, 105, 50, 6, tab); - setBounds(12861, 145, 50, 7, tab); - - //Row 2 - setBounds(12963, 25, 90, 8, tab); - setBounds(13011, 65, 90, 9, tab); - setBounds(12919, 105, 90, 10, tab); - setBounds(12881, 145, 90, 11, tab); - - //Row 3 - setBounds(12951, 25, 130, 12, tab); - setBounds(12999, 65, 130, 13, tab); - setBounds(12911, 105, 130, 14, tab); - setBounds(12871, 145, 130, 15, tab); - - //Row 4 - setBounds(12975, 25, 170, 16, tab); - setBounds(13023, 65, 170, 17, tab); - setBounds(12929, 105, 170, 18, tab); - setBounds(12891, 145, 170, 19, tab); - - //Spell hovers - - //Row 1 - setBounds(21758, 3, 180, 20, tab); - setBounds(21793, 3, 180, 21, tab); - setBounds(21874, 3, 180, 22, tab); - setBounds(21903, 3, 180, 23, tab); - - //Row 2 - setBounds(21988, 3, 180, 24, tab); - setBounds(22018, 3, 180, 25, tab); - setBounds(22068, 3, 180, 26, tab); - setBounds(22093, 3, 180, 27, tab); - - //Row 3 - setBounds(22169, 3, 180, 28, tab); - setBounds(22198, 3, 180, 29, tab); - setBounds(22252, 3, 180, 30, tab); - setBounds(22277, 3, 180, 31, tab); - - //Row 4 - setBounds(22352, 3, 10, 32, tab); - setBounds(22381, 3, 10, 33, tab); - setBounds(22431, 3, 10, 34, tab); - setBounds(22460, 3, 10, 35, tab); - } - - public static void normalSpellbookEdit(GameFont[] t) { - Widget tab = addInterface(39000); - tab.totalChildren(62); - - //ADD "HOME" AND "OTHER" TELEPORTS - setBounds(39101, 10, 9, 0, tab); - setBounds(39102, 10, 9, 1, tab); - setBounds(39104, 105, 9, 2, tab); - setBounds(39105, 105, 9, 3, tab); - - //Row 1 - setBounds(1152, 10, 50, 4, tab); - setBounds(1154, 40, 50, 5, tab); - setBounds(1156, 70, 50, 6, tab); - setBounds(1158, 100, 50, 7, tab); - - //Row 2 - setBounds(1160, 10, 80, 8, tab); - setBounds(1163, 40, 80, 9, tab); - setBounds(1166, 70, 80, 10, tab); - setBounds(1169, 100, 80, 11, tab); - - //Row 3 - setBounds(1172, 10, 110, 12, tab); - setBounds(1175, 40, 110, 13, tab); - setBounds(1177, 70, 110, 14, tab); - setBounds(1181, 100, 110, 15, tab); - - //Row 4 - setBounds(1183, 10, 140, 16, tab); - setBounds(1185, 40, 140, 17, tab); - setBounds(1188, 70, 140, 18, tab); - setBounds(1189, 100, 140, 19, tab); - - //Row 5 - setBounds(1539, 9, 172, 20, tab); - setBounds(1190, 40, 175, 21, tab); - setBounds(1191, 70, 173, 22, tab); - setBounds(1192, 100, 175, 23, tab); - - //Row 6 - setBounds(1572, 35, 230, 24, tab); - setBounds(1582, 65, 230, 25, tab); - setBounds(1592, 95, 230, 26, tab); - setBounds(12445, 125, 230, 27, tab); - - - //Side row - setBounds(1159, 160, 50, 28, tab); - setBounds(15877, 160, 80, 29, tab); - setBounds(1173, 164, 110, 30, tab); - setBounds(1162, 164, 140, 31, tab); - setBounds(1178, 160, 170, 32, tab); - - - //HOVERS - - //Row 1 - setBounds(19226, 3, 180, 33, tab); - setBounds(19297, 3, 180, 34, tab); - setBounds(19371, 3, 180, 35, tab); - setBounds(19429, 3, 180, 36, tab); - setBounds(19458, 3, 180, 37, tab); - - //Row 2 - setBounds(19487, 3, 180, 38, tab); - setBounds(19591, 3, 180, 39, tab); - setBounds(19672, 3, 180, 40, tab); - setBounds(19753, 3, 180, 41, tab); - setBounds(20418, 3, 180, 42, tab); - - //Row 3 - setBounds(19897, 3, 180, 43, tab); - setBounds(19966, 3, 180, 44, tab); - setBounds(20201, 3, 180, 45, tab); - setBounds(20360, 3, 180, 46, tab); - setBounds(19920, 3, 180, 47, tab); - - //Row 4 - setBounds(20576, 3, 180, 48, tab); - setBounds(20663, 3, 180, 49, tab); - setBounds(20780, 3, 180, 50, tab); - setBounds(20867, 3, 180, 51, tab); - setBounds(19568, 3, 180, 52, tab); - - //Row 5 - setBounds(20088, 3, 10, 53, tab); - setBounds(20448, 3, 10, 54, tab); - setBounds(20483, 3, 10, 55, tab); - setBounds(20518, 3, 10, 56, tab); - setBounds(20230, 3, 10, 57, tab); - - //Row 6 - setBounds(19539, 3, 10, 58, tab); - setBounds(20119, 3, 10, 59, tab); - setBounds(20896, 3, 10, 60, tab); - setBounds(21012, 3, 10, 61, tab); - } - - public static void teleportInterface(GameFont[] t) { - Widget tab = addInterface(38100); - tab.totalChildren(13); - tab.drawsTransparent = true; - - //Background - addTransparentSprite(38101, 163, 255); - setBounds(38101, 5, 5, 0, tab); - - //Buttons - - /** MONSTERS **/ - addButton(38102, 38100, 173, 38, 1, 800, 164, 165, 38103, "Monsters"); - addHoveredButton_sprite_loader(38103, 165, 173, 38, 38104); - setBounds(38102, 15, 45, 1, tab); - setBounds(38103, 15, 45, 2, tab); - - /** BOSSES **/ - addButton(38105, 38100, 173, 38, 1, 801, 166, 167, 38106, "Bosses"); - addHoveredButton_sprite_loader(38106, 167, 173, 38, 38107); - setBounds(38105, 15, 88, 3, tab); - setBounds(38106, 15, 88, 4, tab); - - /** Skills **/ - addButton(38108, 38100, 173, 38, 1, 802, 168, 169, 38109, "Skills"); - addHoveredButton_sprite_loader(38109, 169, 173, 38, 38110); - setBounds(38108, 15, 131, 5, tab); - setBounds(38109, 15, 131, 6, tab); - - /** Minigames **/ - addButton(38111, 38100, 173, 38, 1, 803, 170, 171, 38112, "Minigames"); - addHoveredButton_sprite_loader(38112, 171, 173, 38, 38113); - setBounds(38111, 15, 174, 7, tab); - setBounds(38112, 15, 174, 8, tab); - - /** Wilderness **/ - addButton(38114, 38100, 173, 38, 1, 804, 172, 173, 38115, "Wilderness"); - addHoveredButton_sprite_loader(38115, 173, 173, 38, 38116); - setBounds(38114, 15, 217, 9, tab); - setBounds(38115, 15, 217, 10, tab); - - //Close button - addHoverButton_sprite_loader(38117, 137, 17, 17, "Close", -1, 38118, 1); - addHoveredButton_sprite_loader(38118, 138, 17, 17, 38119); - setBounds(38117, 480, 15, 11, tab); - setBounds(38118, 480, 15, 12, tab); - - monsters(t); - bosses(t); - skills(t); - minigames(t); - wilderness(t); - } - - public static void monsters(GameFont[] t) { - Widget tab = addInterface(38200); - tab.parent = 38100; - tab.totalChildren(2); - setBounds(38100, 0, 0, 0, tab); //Main interface - setBounds(38201, 180, 47, 1, tab); //Scroll interface (monsters below) - - Widget scroll = addInterface(38201); - scroll.width = 300; - scroll.height = 270; - scroll.scrollPosition = 0; - scroll.scrollMax = 400; - - //Add all monsters into the scroll.. - String[] tooltips = {"Teleport: Rock Crabs", "Teleport: Pack Yaks", "Teleport: Experiments", "Teleport: Zombies", "Teleport: Bandits", "Teleport: Rock Crab", "Teleport: Rock Crab", "Teleport: Rock Crab", "Teleport: Rock Crab"}; - int[] sprites = {178, 179, 178, 179, 178, 179, 178, 179, 178, 179, 178, 179, 178, 179, 178, 179, 178, 179}; - int sprite_w = 65; - int sprite_h = 54; - int index = 0; - - scroll.totalChildren(tooltips.length * 3); - - int frame = 38202, frameHover = frame + 1, bounds = 0; - for(int i = 0, counter = 0, yDraw = 0; i < tooltips.length; i++, frame+=4, frameHover +=4, counter++, index+=2) { - - int hoverXOffset = 1; - int hoverYOffset = 55; - - if(counter == 3) { - hoverXOffset = -120; - hoverYOffset = 20; - } else if(counter == 4) { - counter = 0; - yDraw += 60; - } - - int x = 22 + (counter * 70); - - String s = tooltips[i]; - addButton(frame, 38200, sprite_w, sprite_h, sprites[index], sprites[index], frameHover, s); - addHoveredButtonWTooltip(frameHover, sprites[index+1], sprite_w, sprite_h, frameHover + 1, frameHover + 2, s, hoverXOffset, hoverYOffset); - setBounds(frame, x, yDraw, bounds++, scroll); - setBounds(frameHover, x, yDraw, bounds++, scroll); - } - - //Now do hovers so that sprites dont draw over - frameHover = 38203; - for(int i = 0, counter = 0, yDraw = 0; i < tooltips.length; i++, frameHover +=4, counter++) { - - if(counter == 4) { - counter = 0; - yDraw += 60; - } - - int x = 22 + (counter * 70); - setBounds(frameHover + 2, x, yDraw, bounds++, scroll); // HOVER - } - } - - public static void bosses(GameFont[] t) { - Widget tab = addInterface(38300); - tab.parent = 38100; - tab.totalChildren(1); - setBounds(38100, 0, 0, 0, tab); - } - - public static void skills(GameFont[] t) { - Widget tab = addInterface(38400); - tab.parent = 38100; - tab.totalChildren(1); - setBounds(38100, 0, 0, 0, tab); - } - - public static void minigames(GameFont[] t) { - Widget tab = addInterface(38500); - tab.parent = 38100; - tab.totalChildren(1); - setBounds(38100, 0, 0, 0, tab); - } - - public static void wilderness(GameFont[] t) { - Widget tab = addInterface(38600); - tab.parent = 38100; - tab.totalChildren(1); - setBounds(38100, 0, 0, 0, tab); - } - - public static void addButton(int i, int parent, int w, int h, int config, int configFrame, int sprite1, int sprite2, int hoverOver, String tooltip) { + public static void addButton(int i, int parent, int w, int h, int config, int configFrame, int sprite1, int sprite2, + int hoverOver, String tooltip) { Widget p = addInterface(i); p.parent = parent; p.type = TYPE_SPRITE; @@ -711,7 +372,8 @@ public static void addButton(int i, int parent, int w, int h, int config, int co p.enabledSprite = Client.cacheSprite[sprite2]; } - public static void addButton(int i, int parent, int w, int h, int sprite1, int sprite2, int hoverOver, String tooltip) { + public static void addButton(int i, int parent, int w, int h, int sprite1, int sprite2, int hoverOver, + String tooltip) { Widget p = addInterface(i); p.parent = parent; p.type = TYPE_SPRITE; @@ -725,8 +387,8 @@ public static void addButton(int i, int parent, int w, int h, int sprite1, int s p.enabledSprite = Client.cacheSprite[sprite2]; } - - public static void addButton(int i, int parent, int w, int h, Sprite sprite1, Sprite sprite2, int hoverOver, String tooltip) { + public static void addButton(int i, int parent, int w, int h, Sprite sprite1, Sprite sprite2, int hoverOver, + String tooltip) { Widget p = addInterface(i); p.parent = parent; p.type = TYPE_SPRITE; @@ -740,7 +402,8 @@ public static void addButton(int i, int parent, int w, int h, Sprite sprite1, Sp p.enabledSprite = sprite2; } - public static void addHoveredButtonWTooltip(int i, int spriteId, int w, int h, int IMAGEID, int tooltipId, String hover, int hoverXOffset, int hoverYOffset) {// hoverable + public static void addHoveredButtonWTooltip(int i, int spriteId, int w, int h, int IMAGEID, int tooltipId, + String hover, int hoverXOffset, int hoverYOffset) {// hoverable // button Widget tab = addTabInterface(i); tab.parent = i; @@ -763,28 +426,15 @@ public static void addHoveredButtonWTooltip(int i, int spriteId, int w, int h, i p.width = w; p.height = h; - p.hoverText = p.defaultText = - p.tooltip = hover; + p.hoverText = p.defaultText = p.tooltip = hover; p.hoverXOffset = hoverXOffset; p.hoverYOffset = hoverYOffset; - p.regularHoverBox = true; - - } - - public static void killFeed(GameFont[] t) { - Widget tab = addInterface(38000); - tab.totalChildren(13); - int y = 45; - for(int i = 38001, index = 0; i < 38014; i++, index++) { - addText(i, "", t, 0, 0xff9040, false, true); - setBounds(i, 10, y, index, tab); - y += 20; - } + p.regularHoverBox = true; } - public static final int BEGIN_READING_PRAYER_INTERFACE = 6;//Amount of total custom prayers we've added - public static final int CUSTOM_PRAYER_HOVERS = 3; //Amount of custom prayer hovers we've added + public static final int BEGIN_READING_PRAYER_INTERFACE = 6; + public static final int CUSTOM_PRAYER_HOVERS = 3; public static final int PRAYER_INTERFACE_CHILDREN = 80 + BEGIN_READING_PRAYER_INTERFACE + CUSTOM_PRAYER_HOVERS; @@ -798,65 +448,67 @@ public static void prayerBook() { Widget rsinterface = interfaceCache[5608]; - //Moves down chivalry + // Moves down chivalry rsinterface.childX[50 + BEGIN_READING_PRAYER_INTERFACE] = 10; - rsinterface.childY[50+ BEGIN_READING_PRAYER_INTERFACE] = 195; - rsinterface.childX[51+ BEGIN_READING_PRAYER_INTERFACE] = 10; - rsinterface.childY[51+ BEGIN_READING_PRAYER_INTERFACE] = 195; - rsinterface.childX[63+ BEGIN_READING_PRAYER_INTERFACE] = 10; - rsinterface.childY[63+ BEGIN_READING_PRAYER_INTERFACE] = 190; - - //Adjust prayer glow sprites position - interfaceCache[rsinterface.children[50+ BEGIN_READING_PRAYER_INTERFACE]].spriteXOffset = -7; - interfaceCache[rsinterface.children[50+ BEGIN_READING_PRAYER_INTERFACE]].spriteYOffset = -2; - - - //Moves piety to the right - rsinterface.childX[52+ BEGIN_READING_PRAYER_INTERFACE] = 43; - rsinterface.childY[52+ BEGIN_READING_PRAYER_INTERFACE] = 204; - rsinterface.childX[53+ BEGIN_READING_PRAYER_INTERFACE] = 43; - rsinterface.childY[53+ BEGIN_READING_PRAYER_INTERFACE] = 204; - rsinterface.childX[64+ BEGIN_READING_PRAYER_INTERFACE] = 43; - rsinterface.childY[64+ BEGIN_READING_PRAYER_INTERFACE] = 190; - - //Adjust prayer glow sprites - interfaceCache[rsinterface.children[52+ BEGIN_READING_PRAYER_INTERFACE]].spriteXOffset = -2; - interfaceCache[rsinterface.children[52+ BEGIN_READING_PRAYER_INTERFACE]].spriteYOffset = -11; - - //Now we add new prayers.. - //AddPrayer adds a glow at the id - //Adds the actual prayer sprite at id+1 - //Adds a hover box at id + 2 + rsinterface.childY[50 + BEGIN_READING_PRAYER_INTERFACE] = 195; + rsinterface.childX[51 + BEGIN_READING_PRAYER_INTERFACE] = 10; + rsinterface.childY[51 + BEGIN_READING_PRAYER_INTERFACE] = 195; + rsinterface.childX[63 + BEGIN_READING_PRAYER_INTERFACE] = 10; + rsinterface.childY[63 + BEGIN_READING_PRAYER_INTERFACE] = 190; + + // Adjust prayer glow sprites position + interfaceCache[rsinterface.children[50 + BEGIN_READING_PRAYER_INTERFACE]].spriteXOffset = -7; + interfaceCache[rsinterface.children[50 + BEGIN_READING_PRAYER_INTERFACE]].spriteYOffset = -2; + + // Moves piety to the right + rsinterface.childX[52 + BEGIN_READING_PRAYER_INTERFACE] = 43; + rsinterface.childY[52 + BEGIN_READING_PRAYER_INTERFACE] = 204; + rsinterface.childX[53 + BEGIN_READING_PRAYER_INTERFACE] = 43; + rsinterface.childY[53 + BEGIN_READING_PRAYER_INTERFACE] = 204; + rsinterface.childX[64 + BEGIN_READING_PRAYER_INTERFACE] = 43; + rsinterface.childY[64 + BEGIN_READING_PRAYER_INTERFACE] = 190; + + // Adjust prayer glow sprites + interfaceCache[rsinterface.children[52 + BEGIN_READING_PRAYER_INTERFACE]].spriteXOffset = -2; + interfaceCache[rsinterface.children[52 + BEGIN_READING_PRAYER_INTERFACE]].spriteYOffset = -11; + + // Now we add new prayers.. + // AddPrayer adds a glow at the id + // Adds the actual prayer sprite at id+1 + // Adds a hover box at id + 2 addPrayer(28001, "Activate @or1@Preserve", 31, 32, 150, -2, -1, 151, 152, 1, 708, 28003); - setBounds(28001, 153, 158, 0, rsinterface); //Prayer glow sprite - setBounds(28002, 153, 158, 1, rsinterface); //Prayer sprites - + setBounds(28001, 153, 158, 0, rsinterface); // Prayer glow sprite + setBounds(28002, 153, 158, 1, rsinterface); // Prayer sprites addPrayer(28004, "Activate @or1@Rigour", 31, 32, 150, -3, -5, 153, 154, 1, 710, 28006); - setBounds(28004, 84, 198, 2, rsinterface); //Prayer glow sprite - setBounds(28005, 84, 198, 3, rsinterface); //Prayer sprites + setBounds(28004, 84, 198, 2, rsinterface); // Prayer glow sprite + setBounds(28005, 84, 198, 3, rsinterface); // Prayer sprites addPrayer(28007, "Activate @or1@Augury", 31, 32, 150, -3, -5, 155, 156, 1, 712, 28009); - setBounds(28007, 120, 198, 4, rsinterface); //Prayer glow sprite - setBounds(28008, 120, 198, 5, rsinterface); //Prayer sprites + setBounds(28007, 120, 198, 4, rsinterface); // Prayer glow sprite + setBounds(28008, 120, 198, 5, rsinterface); // Prayer sprites - //Now we add hovers.. + // Now we add hovers.. addPrayerHover(28003, "Level 55\nPreserve\nBoosted stats last 20% longer.", -135, -60); - setBounds(28003, 153, 158, 86, rsinterface); //Hover box + setBounds(28003, 153, 158, 86, rsinterface); // Hover box - addPrayerHover(28006, "Level 74\nRigour\nIncreases your Ranged attack\nby 20% and damage by 23%,\nand your defence by 25%", -70, -100); - setBounds(28006, 84, 200, 87, rsinterface); //Hover box + addPrayerHover(28006, + "Level 74\nRigour\nIncreases your Ranged attack\nby 20% and damage by 23%,\nand your defence by 25%", + -70, -100); + setBounds(28006, 84, 200, 87, rsinterface); // Hover box - addPrayerHover(28009, "Level 77\nAugury\nIncreases your Magic attack\nby 25% and your defence by 25%", -110, -100); - setBounds(28009, 120, 198, 88, rsinterface); //Hover box + addPrayerHover(28009, "Level 77\nAugury\nIncreases your Magic attack\nby 25% and your defence by 25%", -110, + -100); + setBounds(28009, 120, 198, 88, rsinterface); // Hover box } - public static void addPrayer(int ID, String tooltip, int w, int h, int glowSprite, int glowX, int glowY, int disabledSprite, int enabledSprite, int config, int configFrame, int hover) { + public static void addPrayer(int ID, String tooltip, int w, int h, int glowSprite, int glowX, int glowY, + int disabledSprite, int enabledSprite, int config, int configFrame, int hover) { Widget p = addTabInterface(ID); - //Adding config-toggleable glow on the prayer - //Also clickable + // Adding config-toggleable glow on the prayer + // Also clickable p.parent = 5608; p.type = TYPE_SPRITE; p.atActionType = 1; @@ -877,8 +529,8 @@ public static void addPrayer(int ID, String tooltip, int w, int h, int glowSprit p.spriteXOffset = glowX; p.spriteYOffset = glowY; - //Adding config-toggleable prayer sprites - //not clickable + // Adding config-toggleable prayer sprites + // not clickable p = addTabInterface(ID + 1); p.parent = 5608; p.type = TYPE_SPRITE; @@ -895,19 +547,21 @@ public static void addPrayer(int ID, String tooltip, int w, int h, int glowSprit p.valueIndexArray[0][2] = 0; p.tooltip = tooltip; p.defaultText = tooltip; - p.enabledSprite = Client.cacheSprite[disabledSprite]; //imageLoader(disabledSprite, "s"); - p.disabledSprite = Client.cacheSprite[enabledSprite]; //imageLoader(enabledSprite, "s"); + p.enabledSprite = Client.cacheSprite[disabledSprite]; // imageLoader(disabledSprite, + // "s"); + p.disabledSprite = Client.cacheSprite[enabledSprite]; // imageLoader(enabledSprite, + // "s"); p.hoverType = hover; } public static void addPrayerHover(int ID, String hover, int xOffset, int yOffset) { - //Adding hover box + // Adding hover box Widget p = addTabInterface(ID); p.parent = 5608; p.type = 8; p.width = 40; p.height = 32; - p.hoverText = p.defaultText = hover; + p.hoverText = p.defaultText = hover; p.hoverXOffset = xOffset; p.hoverYOffset = yOffset; p.regularHoverBox = true; @@ -918,7 +572,7 @@ public static void addPrayerHover(int ID, String hover, int xOffset, int yOffset */ private static void priceChecker(GameFont[] fonts) { Widget rsi = addTabInterface(42000); - final String[] options = {"Remove 1", "Remove 5", "Remove 10", "Remove All", "Remove X"}; + final String[] options = { "Remove 1", "Remove 5", "Remove 10", "Remove All", "Remove X" }; addAdvancedSprite(18245, 180); addHoverButton_sprite_loader(18247, 137, 17, 17, "Close", -1, 18250, 1); @@ -933,7 +587,7 @@ private static void priceChecker(GameFont[] fonts) { addText(18351, "0", fonts, 0, 0xFFFFFF, true, true); addText(18355, "", fonts, 0, 0xFFFFFF, true, true); - //Actual items + // Actual items Widget container = addTabInterface(18500); container.actions = options; container.spritesX = new int[20]; @@ -944,7 +598,7 @@ private static void priceChecker(GameFont[] fonts) { container.filled = false; container.replaceItems = false; container.usableItems = false; - //rsi.isInventoryInterface = false; + // rsi.isInventoryInterface = false; container.allowSwapItems = false; container.spritePaddingX = 50; container.spritePaddingY = 30; @@ -956,26 +610,26 @@ private static void priceChecker(GameFont[] fonts) { rsi.totalChildren(58); int child = 0; - rsi.child(child++, 18245, 10, 20);//was 10 so + 10 - rsi.child(child++, 18247, 471, 23); + rsi.child(child++, 18245, 10, 20);// was 10 so + 10 + rsi.child(child++, 18247, 471, 23); rsi.child(child++, 18351, 251, 306); rsi.child(child++, 18355, 260, 155); - rsi.child(child++, 18250, 471, 23); //Close button hover - rsi.child(child++, 18500, 28, 50); //Container + rsi.child(child++, 18250, 471, 23); // Close button hover + rsi.child(child++, 18500, 28, 50); // Container - //Deposit hovers + // Deposit hovers rsi.child(child++, 18252, 455, 285); rsi.child(child++, 18253, 455, 285); rsi.child(child++, 18255, 420, 285); rsi.child(child++, 18256, 420, 285); - //Add text next to items, ROW 1 + // Add text next to items, ROW 1 int interface_ = 18300; int xDraw = 47; int yDraw = 81; int counter = 0; - for(int i = 0; i < container.inventoryItemId.length; i++) { + for (int i = 0; i < container.inventoryItemId.length; i++) { addText(interface_, "", fonts, 0, 0xFFFFFF, true, true); rsi.child(child++, interface_, xDraw, yDraw); @@ -984,19 +638,19 @@ private static void priceChecker(GameFont[] fonts) { counter++; xDraw += 80; - if(counter == container.width) { + if (counter == container.width) { xDraw = 47; yDraw += 62; counter = 0; } } - //Add text next to items, ROW 2 + // Add text next to items, ROW 2 interface_ = 18400; xDraw = 47; yDraw = 93; counter = 0; - for(int i = 0; i < container.inventoryItemId.length; i++) { + for (int i = 0; i < container.inventoryItemId.length; i++) { addText(interface_, "", fonts, 0, 0xFFFFFF, true, true); rsi.child(child++, interface_, xDraw, yDraw); @@ -1005,7 +659,7 @@ private static void priceChecker(GameFont[] fonts) { counter++; xDraw += 80; - if(counter == container.width) { + if (counter == container.width) { xDraw = 47; yDraw += 62; counter = 0; @@ -1023,7 +677,7 @@ public static void shop() { rsinterface.spritePaddingX = 15; rsinterface.spritePaddingY = 25; - //Position the item container in the actual shop interface + // Position the item container in the actual shop interface rsinterface = interfaceCache[3824]; setBounds(3900, 26, 65, 75, rsinterface); } @@ -1033,7 +687,7 @@ public static void bounty(GameFont[] TDA) { addTransparentSprite(23301, 97, 150); addConfigSprite(23303, -1, 98, 0, 876); - // addSprite(23304, 104); + // addSprite(23304, 104); addText(23305, "---", TDA, 0, 0xffff00, true, true); addText(23306, "Target:", TDA, 0, 0xffff00, true, true); @@ -1055,7 +709,7 @@ public static void bounty(GameFont[] TDA) { addConfigSprite(23320, -1, 103, 0, 881); addText(23321, "Level: ", TDA, 1, 0xFFFF33, true, false); - //Kda + // Kda addTransparentSprite(23322, 97, 150); addText(23323, "Targets killed: 0", TDA, 0, 0xFFFF33, true, false); addText(23324, "Players killed: 0", TDA, 0, 0xFFFF33, true, false); @@ -1064,25 +718,25 @@ public static void bounty(GameFont[] TDA) { tab.totalChildren(18); tab.child(0, 23301, 319, 8); tab.child(1, 23322, 319, 54); - // tab.child(1, 23302, 339, 56); + // tab.child(1, 23302, 339, 56); tab.child(2, 23303, 345, 65); // tab.child(2, 23304, 348, 73); tab.child(3, 23305, 358, 84); tab.child(4, 23306, 455, 58); tab.child(5, 23307, 456, 71); tab.child(6, 23308, 457, 87); - // tab.child(8, 23309, 460, 59); - // tab.child(9, 23310, 438, 72); - // tab.child(10, 23311, 481, 72); - // tab.child(11, 23312, 438, 85); - // tab.child(12, 23313, 481, 85); - // tab.child(13, 23314, 393, 72); - // tab.child(14, 23315, 394, 85); + // tab.child(8, 23309, 460, 59); + // tab.child(9, 23310, 438, 72); + // tab.child(10, 23311, 481, 72); + // tab.child(11, 23312, 438, 85); + // tab.child(12, 23313, 481, 85); + // tab.child(13, 23314, 393, 72); + // tab.child(14, 23315, 394, 85); tab.child(7, 23316, 345, 65); tab.child(8, 23317, 345, 65); tab.child(9, 23318, 345, 65); tab.child(10, 23319, 345, 65); - tab.child(11, 23320, 345, 65); + tab.child(11, 23320, 345, 65); tab.child(12, 23323, 435, 13); tab.child(13, 23324, 435, 26); @@ -1100,7 +754,7 @@ public static void bounty(GameFont[] TDA) { public static void itemsKeptOnDeath(GameFont[] tda) { - removeSomething(16999); //close button in text + removeSomething(16999); // close button in text Widget rsinterface = interfaceCache[10494]; rsinterface.spritePaddingX = 6; rsinterface.spritePaddingY = 5; @@ -1108,18 +762,18 @@ public static void itemsKeptOnDeath(GameFont[] tda) { rsinterface.spritePaddingX = 6; rsinterface.spritePaddingY = 5; - rsinterface = addInterface(17100); addSpriteLoader(17101, 139); - /*Widget scroll = addTabInterface(17149); - scroll.width = 300; scroll.height = 183; scroll.scrollMax = 220;*/ + /* + * Widget scroll = addTabInterface(17149); scroll.width = 300; + * scroll.height = 183; scroll.scrollMax = 220; + */ addText(17103, "Items Kept on Death", tda, 2, 0xff981f, false, false); addText(17104, "Items you will keep on death:", tda, 1, 0xff981f, false, false); addText(17105, "Items you will lose on death:", tda, 1, 0xff981f, false, false); addText(17106, "Info", tda, 1, 0xff981f, false, false); addText(17107, "3", tda, 2, 0xffff00, false, false); - String[] options = {null}; - + String[] options = { null }; addHoverButton_sprite_loader(17018, 137, 17, 17, "Close", -1, 17019, 1); addHoveredButton_sprite_loader(17019, 138, 17, 17, 17020); @@ -1128,39 +782,39 @@ public static void itemsKeptOnDeath(GameFont[] tda) { * Items on interface */ - //Top Row - for(int top = 17108; top <= 17111; top++) { + // Top Row + for (int top = 17108; top <= 17111; top++) { addItemOnInterface(top, 17100, options); } - //1st row - for(int top = 17112; top <= 17119; top++) { + // 1st row + for (int top = 17112; top <= 17119; top++) { addItemOnInterface(top, 17100, options); } - //2nd row - for(int top = 17120; top <= 17127; top++) { + // 2nd row + for (int top = 17120; top <= 17127; top++) { addItemOnInterface(top, 17100, options); } - //3rd row - for(int top = 17128; top <= 17135; top++) { + // 3rd row + for (int top = 17128; top <= 17135; top++) { addItemOnInterface(top, 17100, options); } - //4th row + // 4th row for (int top = 17136; top <= 17142; top++) { addItemOnInterface(top, 17100, options); } - //5th row + // 5th row for (int top = 17143; top <= 17148; top++) { addItemOnInterface(top, 17100, options); } - //6th row (4 items) - for(int top = 17149; top <= 17152; top++) { + // 6th row (4 items) + for (int top = 17149; top <= 17152; top++) { addItemOnInterface(top, 17100, options); } setChildren(58, rsinterface); addTabInterface(5); - setBounds(17101, 7,8, 0, rsinterface); + setBounds(17101, 7, 8, 0, rsinterface); setBounds(16999, 478, 14, 1, rsinterface); setBounds(17103, 185, 18, 2, rsinterface); setBounds(17104, 22, 50, 3, rsinterface); @@ -1173,10 +827,10 @@ public static void itemsKeptOnDeath(GameFont[] tda) { setBounds(17019, 480, 18, 9, rsinterface); setBounds(5, 480, 18, 10, rsinterface); - //Positions for item on interface (items kept on death - int child_index = 11; + // Positions for item on interface (items kept on death + int child_index = 11; int topPos = 26; - for(int top = 17108; top <= 17111; top++) { + for (int top = 17108; top <= 17111; top++) { setBounds(top, topPos, 72, child_index, rsinterface); topPos += 44; child_index++; @@ -1187,34 +841,34 @@ public static void itemsKeptOnDeath(GameFont[] tda) { topPos = 26; - //1st row - for(int top = 17112; top <= 17118; top++) { + // 1st row + for (int top = 17112; top <= 17118; top++) { setBounds(top, topPos, 133, child_index, rsinterface); topPos += 44; child_index++; } - //2nd row + // 2nd row topPos = 26; - for(int top = 17119; top <= 17125; top++) { + for (int top = 17119; top <= 17125; top++) { setBounds(top, topPos, 168, child_index, rsinterface); topPos += 44; child_index++; } - //3rd row + // 3rd row topPos = 26; - for(int top = 17126; top <= 17132; top++) { + for (int top = 17126; top <= 17132; top++) { setBounds(top, topPos, 203, child_index, rsinterface); topPos += 44; child_index++; } - //4th row + // 4th row topPos = 26; for (int top = 17133; top <= 17139; top++) { setBounds(top, topPos, 238, child_index, rsinterface); topPos += 44; child_index++; } - //5th row + // 5th row topPos = 26; for (int top = 17140; top <= 17145; top++) { setBounds(top, topPos, 273, child_index, rsinterface); @@ -1222,9 +876,9 @@ public static void itemsKeptOnDeath(GameFont[] tda) { child_index++; } - //6th row (4 items) + // 6th row (4 items) topPos = 26; - for(int top = 17146; top <= 17152; top++) { + for (int top = 17146; top <= 17152; top++) { setBounds(top, topPos, 311, child_index, rsinterface); topPos += 44; child_index++; @@ -1336,64 +990,6 @@ public static void debugInterface() { } } - public static void repositionModernSpells() { - - Widget widget = Widget.interfaceCache[12424]; - for (int index = 0; index < widget.children.length; index++) { - - switch (widget.children[index]) { - - case 1185: - widget.childX[33] = 148; - widget.childY[33] = 150; - break; - - case 1183: // wind wave - widget.childX[31] = 76; - widget.childY[31] = 149; - break; - - case 1188: // earth wave - widget.childX[36] = 71; - widget.childY[36] = 172; - break; - - case 1543: - widget.childX[46] = 96; - widget.childY[46] = 173; - break; - - case 1193: // charge - widget.childX[41] = 49; - widget.childY[41] = 198; - break; - - case 12435: // tele other falador - widget.childX[54] = 74; - widget.childY[54] = 198; - break; - - case 12445: // teleblock - widget.childX[55] = 99; - widget.childY[55] = 198; - break; - - case 6003: // lvl 6 enchant - widget.childX[57] = 122; - widget.childY[57] = 198; - break; - - // 150 x is end of the line - - case 12455: // tele other camelot - widget.childX[56] = 147; - widget.childY[56] = 198; - break; - } - } - } - - public static void clanChatTab(GameFont[] tda) { Widget tab = addTabInterface(37128); @@ -1413,8 +1009,8 @@ public static void clanChatTab(GameFont[] tda) { addText(37139, "Talking in: N/A", tda, 0, 0xff9b00, false, true); addText(37140, "Owner: N/A", tda, 0, 0xff9b00, false, true); tab.totalChildren(11); - //tab.child(0, 16126, 0, 221); - //tab.child(1, 16126, 0, 59); + // tab.child(0, 16126, 0, 221); + // tab.child(1, 16126, 0, 59); tab.child(0, 37137, 0, 62); tab.child(1, 37143, 0, 62); @@ -1434,16 +1030,9 @@ public static void clanChatTab(GameFont[] tda) { addText(i, "", tda, 0, 0xffffff, false, true); } for (int id = 37144, i = 0; id <= 37243 && i <= 99; id++, i++) { - interfaceCache[id].actions = new String[] { - "Promote to Recruit", - "Promote to Corporal", - "Promote to Sergeant", - "Promote to Lieutenant", - "Promote to Captain", - "Promote to General", - "Demote", - "Kick" - }; + interfaceCache[id].actions = new String[] { "Promote to Recruit", "Promote to Corporal", + "Promote to Sergeant", "Promote to Lieutenant", "Promote to Captain", "Promote to General", + "Demote", "Kick" }; interfaceCache[id].parent = 37128; list.children[i] = id; list.childX[i] = 5; @@ -1583,7 +1172,6 @@ public static void addText(int id, String text, GameFont wid[], int idx, int col rsinterface.secondaryHoverColor = 0; } - public static void equipmentTab(GameFont[] wid) { Widget Interface = interfaceCache[1644]; addSprite(15101, 0, "Interfaces/Equipment/bl");// cheap hax @@ -1633,7 +1221,6 @@ public static void removeConfig(int id) { Widget rsi = interfaceCache[id] = new Widget(); } - public static void equipmentScreen(GameFont[] wid) { Widget Interface = Widget.interfaceCache[1644]; addButton(19144, 140, "Show Equipment Stats"); @@ -1713,7 +1300,7 @@ public static void equipmentScreen(GameFont[] wid) { tab.child(42, 1667, 321 + 134, 58 + 162); tab.child(43, 1688, 50 + 297 - 2, 110 - 13 + 5); - //Maxhits + // Maxhits tab.child(44, 15115, 370, 260); tab.child(45, 15116, 370, 275); tab.child(46, 15117, 370, 290); @@ -1756,8 +1343,10 @@ public static void addButton(int id, int sid, String tooltip) { tab.contentType = 0; tab.opacity = (byte) 0; tab.hoverType = 52; - tab.disabledSprite = Client.cacheSprite[sid];// imageLoader(sid, spriteName); - tab.enabledSprite = Client.cacheSprite[sid];//imageLoader(sid, spriteName); + tab.disabledSprite = Client.cacheSprite[sid];// imageLoader(sid, + // spriteName); + tab.enabledSprite = Client.cacheSprite[sid];// imageLoader(sid, + // spriteName); tab.width = tab.disabledSprite.myWidth; tab.height = tab.enabledSprite.myHeight; tab.tooltip = tooltip; @@ -2074,7 +1663,7 @@ public static void addItemOnInterface(int childId, int interfaceId, String[] opt rsi.filled = false; rsi.replaceItems = false; rsi.usableItems = false; - //rsi.isInventoryInterface = false; + // rsi.isInventoryInterface = false; rsi.allowSwapItems = false; rsi.spritePaddingX = 4; rsi.spritePaddingY = 5; @@ -2127,8 +1716,8 @@ public static void addText(int i, String s, int k, boolean l, boolean m, int a, RSInterface.textColor = k; } - public static void addConfigButton(int ID, int pID, int bID, int bID2, int width, int height, - String tT, int configID, int aT, int configFrame) { + public static void addConfigButton(int ID, int pID, int bID, int bID2, int width, int height, String tT, + int configID, int aT, int configFrame) { Widget Tab = addTabInterface(ID); Tab.parent = pID; Tab.id = ID; @@ -2147,7 +1736,7 @@ public static void addConfigButton(int ID, int pID, int bID, int bID2, int width Tab.valueIndexArray[0][0] = 5; Tab.valueIndexArray[0][1] = configFrame; Tab.valueIndexArray[0][2] = 0; - Tab.disabledSprite = Client.cacheSprite[bID];//imageLoader(bID, bName); + Tab.disabledSprite = Client.cacheSprite[bID];// imageLoader(bID, bName); Tab.enabledSprite = Client.cacheSprite[bID2]; Tab.tooltip = tT; } @@ -2184,8 +1773,9 @@ public static void addHoverButton(int i, String imageName, int j, int width, int tab.height = height; tab.tooltip = text; } - - public static void addHoverText(int id, String text, String tooltip, GameFont tda[], int idx, int color, boolean center, boolean textShadow, int width) { + + public static void addHoverText(int id, String text, String tooltip, GameFont tda[], int idx, int color, + boolean center, boolean textShadow, int width) { Widget rsinterface = addInterface(id); rsinterface.id = id; rsinterface.parent = id; @@ -2218,40 +1808,40 @@ private static void bankInterface(GameFont[] tda) { Sprite disabled = Client.cacheSprite[129]; Sprite enabled = Client.cacheSprite[130]; - ///Sprite button1 = getSprite(0, interfaceLoader, "miscgraphics"); - //Sprite button2 = getSprite(9, interfaceLoader, "miscgraphics"); + /// Sprite button1 = getSprite(0, interfaceLoader, "miscgraphics"); + // Sprite button2 = getSprite(9, interfaceLoader, "miscgraphics"); addSprite(id, 106); addHoverButton_sprite_loader(id + 1, 107, 17, 17, "Close", -1, id + 2, 1); addHoveredButton_sprite_loader(id + 2, 108, 17, 17, id + 3); - + bank.child(child++, id, 12, 2); bank.child(child++, id + 1, 472, 9); bank.child(child++, id + 2, 472, 9); - + addHoverButton_sprite_loader(id + 4, 117, 32, 32, "Deposit Inventory", -1, id + 5, 1); addHoveredButton_sprite_loader(id + 5, 118, 32, 32, id + 6); - + addHoverButton_sprite_loader(id + 7, 119, 32, 32, "Deposit Equipment", -1, id + 8, 1); addHoveredButton_sprite_loader(id + 8, 120, 32, 32, id + 9); - + addHoverButtonWConfig(id + 10, 115, 116, 32, 32, "Search", -1, id + 11, 1, 117, 117); addHoveredButton_sprite_loader(id + 11, 116, 32, 32, id + 12); - bank.child(child++, id + 4, 415, 292); bank.child(child++, id + 5, 415, 292); bank.child(child++, id + 7, 455, 292); bank.child(child++, id + 8, 455, 292); bank.child(child++, id + 10, 375, 292); bank.child(child++, id + 11, 375, 292); - - addButton(id + 13, getSprite(0, interfaceLoader, "miscgraphics3"), getSprite(0, interfaceLoader, "miscgraphics3"), "Show menu", 25, 25); + + addButton(id + 13, getSprite(0, interfaceLoader, "miscgraphics3"), + getSprite(0, interfaceLoader, "miscgraphics3"), "Show menu", 25, 25); addSprite(id + 14, 209); bank.child(child++, id + 13, 463, 43); bank.child(child++, id + 14, 463, 44); - - //Text + + // Text addText(id + 53, "%1", tda, 0, 0xFE9624, true); Widget line = addInterface(id + 54); line.type = 3; @@ -2263,7 +1853,7 @@ private static void bankInterface(GameFont[] tda) { bank.child(child++, id + 53, 30, 8); bank.child(child++, id + 54, 24, 19); bank.child(child++, id + 55, 30, 20); - + bank.child(child++, 5383, 180, 12); bank.child(child++, 5385, 0, 79); bank.child(child++, 8131, 102, 306); @@ -2276,40 +1866,43 @@ private static void bankInterface(GameFont[] tda) { bank.child(child++, 5389, 227, 309); bank.child(child++, 5391, 311, 309); bank.child(child++, 5388, 248, 291); - + id = 50070; for (int tab = 0, counter = 0; tab <= 36; tab += 4, counter++) { - // addHoverButton_sprite_loader(id + 1 + tab, 206, 39, 40, null, -1, id + 2 + tab, 1); - // addHoveredButton_sprite_loader(id + 2 + tab, 207, 39, 40, id + 3 + tab); + // addHoverButton_sprite_loader(id + 1 + tab, 206, 39, 40, null, -1, + // id + 2 + tab, 1); + // addHoveredButton_sprite_loader(id + 2 + tab, 207, 39, 40, id + 3 + // + tab); - - int[] requiredValues = new int[]{1}; - int[] valueCompareType = new int[]{1}; + int[] requiredValues = new int[] { 1 }; + int[] valueCompareType = new int[] { 1 }; int[][] valueIndexArray = new int[1][3]; valueIndexArray[0][0] = 5; - valueIndexArray[0][1] = 1000 + counter; //Config + valueIndexArray[0][1] = 1000 + counter; // Config valueIndexArray[0][2] = 0; - - - addHoverConfigButton(id + tab, id + 1 + tab, 206, -1, 39, 40, null, valueCompareType, requiredValues, valueIndexArray); + + addHoverConfigButton(id + tab, id + 1 + tab, 206, -1, 39, 40, null, valueCompareType, requiredValues, + valueIndexArray); addHoveredConfigButton(interfaceCache[id + tab], id + 1 + tab, id + 2 + tab, 207, -1); - - - //addHoverButtonWConfig(id + 1 + tab, 206, -1, 39, 40, null, -1, id + 2 + tab, 1, 1, 1000+counter); - //addHoveredButton_sprite_loader(id + 2 + tab, 207, 39, 40, id + 3 + tab); - - interfaceCache[id + tab].actions = new String[]{"Select", tab == 0 ? null : "Collapse", null, null, null}; + + // addHoverButtonWConfig(id + 1 + tab, 206, -1, 39, 40, null, -1, id + // + 2 + tab, 1, 1, 1000+counter); + // addHoveredButton_sprite_loader(id + 2 + tab, 207, 39, 40, id + 3 + // + tab); + + interfaceCache[id + tab].actions = new String[] { "Select", tab == 0 ? null : "Collapse", null, null, + null }; interfaceCache[id + tab].parent = id; interfaceCache[id + tab].drawingDisabled = true; interfaceCache[id + 1 + tab].parent = id; bank.child(child++, id + tab, 19 + 40 * (tab / 4), 37); bank.child(child++, id + 1 + tab, 19 + 40 * (tab / 4), 37); } - + interfaceCache[5385].height = 206; interfaceCache[5385].width = 474; - + int[] interfaces = new int[] { 5386, 5387, 8130, 8131 }; for (int rsint : interfaces) { @@ -2318,21 +1911,21 @@ private static void bankInterface(GameFont[] tda) { interfaceCache[rsint].width = enabled.myWidth; interfaceCache[rsint].height = enabled.myHeight; } - + addSprite(50040, 208); bank.child(child++, 50040, 20, 41); - - + final Widget scrollBar = Widget.interfaceCache[5385]; scrollBar.totalChildren(Client.MAX_BANK_TABS); - for(int i = 0; i < Client.MAX_BANK_TABS; i++) { - addBankTabContainer(50300 + i, 109, 10, 35, 352, new String[] { "Withdraw-1", "Withdraw-5", "Withdraw-10", "Withdraw-All", "Withdraw-X", null, "Withdraw-All but one" }); + for (int i = 0; i < Client.MAX_BANK_TABS; i++) { + addBankTabContainer(50300 + i, 109, 10, 35, 352, new String[] { "Withdraw-1", "Withdraw-5", "Withdraw-10", + "Withdraw-All", "Withdraw-X", null, "Withdraw-All but one" }); scrollBar.child(i, 50300 + i, 40, 0); } } - - - public static void addHoverText(int id, String text, String tooltip, GameFont tda[], int idx, int color, boolean center, boolean textShadow, int width, int hoveredColor) { + + public static void addHoverText(int id, String text, String tooltip, GameFont tda[], int idx, int color, + boolean center, boolean textShadow, int width, int hoveredColor) { Widget rsinterface = addInterface(id); rsinterface.id = id; rsinterface.parent = id; @@ -2354,24 +1947,24 @@ public static void addHoverText(int id, String text, String tooltip, GameFont td rsinterface.secondaryHoverColor = 0; rsinterface.tooltip = tooltip; } - - + /** * Bank settings + * * @param t */ public static void bankSettings(GameFont[] t) { Widget tab = addInterface(32500); addSprite(32501, 229); - addText(32502, ""+Configuration.CLIENT_NAME+" Bank Settings", 0xff9933, true, true, -1, t, 2); - + addText(32502, "" + Configuration.CLIENT_NAME + " Bank Settings", 0xff9933, true, true, -1, t, 2); + addHoverButton_sprite_loader(32503, 107, 21, 21, "Close", -1, 32504, 1); addHoveredButton_sprite_loader(32504, 108, 21, 21, 32505); - + addConfigButton(32506, 32500, 230, 231, 14, 15, "Select", 0, 5, 1111); addConfigButton(32507, 32500, 230, 231, 14, 15, "Select", 1, 5, 1111); addConfigButton(32508, 32500, 230, 231, 14, 15, "Select", 2, 5, 1111); - + addText(32509, "First item in tab", 0xff9933, true, true, -1, t, 1); addText(32510, "Digit (1, 2, 3)", 0xff9933, true, true, -1, t, 1); addText(32511, "Roman numeral (I, II, III)", 0xff9933, true, true, -1, t, 1); @@ -2389,7 +1982,7 @@ public static void bankSettings(GameFont[] t) { tab.child(9, 32511, 239, 65 + 90); tab.child(10, 32512, 275, 265); } - + public static void addHoveredConfigButton(Widget original, int ID, int IMAGEID, int disabledID, int enabledID) { Widget rsint = addTabInterface(ID); rsint.parent = original.id; @@ -2408,17 +2001,18 @@ public static void addHoveredConfigButton(Widget original, int ID, int IMAGEID, hover.valueCompareType = original.valueCompareType; hover.requiredValues = original.requiredValues; hover.valueIndexArray = original.valueIndexArray; - if(disabledID != -1) + if (disabledID != -1) hover.disabledSprite = Client.cacheSprite[disabledID]; - if(enabledID != -1) + if (enabledID != -1) hover.enabledSprite = Client.cacheSprite[enabledID]; rsint.totalChildren(1); setBounds(IMAGEID, 0, 0, 0, rsint); rsint.tooltip = original.tooltip; rsint.invisible = true; } - - public static void addHoverConfigButton(int id, int hoverOver, int disabledID, int enabledID, int width, int height, String tooltip, int[] valueCompareType, int[] requiredValues, int[][] valueIndexArray) { + + public static void addHoverConfigButton(int id, int hoverOver, int disabledID, int enabledID, int width, int height, + String tooltip, int[] valueCompareType, int[] requiredValues, int[][] valueIndexArray) { Widget rsint = addTabInterface(id); rsint.parent = id; rsint.id = id; @@ -2432,13 +2026,13 @@ public static void addHoverConfigButton(int id, int hoverOver, int disabledID, i rsint.valueCompareType = valueCompareType; rsint.requiredValues = requiredValues; rsint.valueIndexArray = valueIndexArray; - if(disabledID != -1) + if (disabledID != -1) rsint.disabledSprite = Client.cacheSprite[disabledID]; - if(enabledID != -1) + if (enabledID != -1) rsint.enabledSprite = Client.cacheSprite[enabledID]; rsint.tooltip = tooltip; } - + public static void addButton(int id, Sprite enabled, Sprite disabled, String tooltip, int w, int h) { Widget tab = interfaceCache[id] = new Widget(); tab.id = id; @@ -2454,8 +2048,9 @@ public static void addButton(int id, Sprite enabled, Sprite disabled, String too tab.height = h; tab.tooltip = tooltip; } - - public static void addConfigButton(int ID, int pID, Sprite disabled, Sprite enabled, int width, int height, String tT, int configID, int aT, int configFrame) { + + public static void addConfigButton(int ID, int pID, Sprite disabled, Sprite enabled, int width, int height, + String tT, int configID, int aT, int configFrame) { Widget Tab = addTabInterface(ID); Tab.parent = pID; Tab.id = ID; @@ -2478,8 +2073,9 @@ public static void addConfigButton(int ID, int pID, Sprite disabled, Sprite enab Tab.enabledSprite = enabled; Tab.tooltip = tT; } - - public static Widget addBankTabContainer(int id, int contentType, int width, int height, int size, String... actions) { + + public static Widget addBankTabContainer(int id, int contentType, int width, int height, int size, + String... actions) { Widget container = addInterface(id); container.parent = id; container.type = 2; @@ -2507,17 +2103,8 @@ public static void addSpriteLoader(int childId, int spriteId) { rsi.contentType = 0; rsi.disabledSprite = Client.cacheSprite[spriteId]; rsi.enabledSprite = Client.cacheSprite[spriteId]; - - - //rsi.sprite1.spriteLoader = rsi.sprite2.spriteLoader = true; - //rsi.hoverSprite1 = Client.cacheSprite[hoverSpriteId]; - //rsi.hoverSprite2 = Client.cacheSprite[hoverSpriteId]; - //rsi.hoverSprite1.spriteLoader = rsi.hoverSprite2.spriteLoader = true; - //rsi.sprite1 = rsi.sprite2 = spriteId; - //rsi.hoverSprite1Id = rsi.hoverSprite2Id = hoverSpriteId; rsi.width = rsi.disabledSprite.myWidth; rsi.height = rsi.enabledSprite.myHeight - 2; - //rsi.isFalseTooltip = true; } public static void addSprite(int childId, Sprite sprite1, Sprite sprite2) { @@ -2533,8 +2120,6 @@ public static void addSprite(int childId, Sprite sprite1, Sprite sprite2) { rsi.height = rsi.enabledSprite.myHeight - 2; } - - public static void addButtonWSpriteLoader(int id, int spriteId) { Widget tab = interfaceCache[id] = new Widget(); tab.id = id; @@ -2572,13 +2157,12 @@ public static void addHoverButtonWConfig(int i, int spriteId, int spriteId2, int tab.valueIndexArray[0][0] = 5; tab.valueIndexArray[0][1] = configFrame; tab.valueIndexArray[0][2] = 0; - if(spriteId != -1) + if (spriteId != -1) tab.disabledSprite = Client.cacheSprite[spriteId]; - if(spriteId2 != -1) + if (spriteId2 != -1) tab.enabledSprite = Client.cacheSprite[spriteId2]; } - public static void addHoverButton_sprite_loader(int i, int spriteId, int width, int height, String text, int contentType, int hoverOver, int aT) {// hoverable // button @@ -2630,8 +2214,7 @@ public static void addHoverImage_sprite_loader(int i, int spriteId) { tab.enabledSprite = Client.cacheSprite[spriteId]; } - public static void addBankItem(int index, Boolean hasOption) - { + public static void addBankItem(int index, Boolean hasOption) { Widget rsi = interfaceCache[index] = new Widget(); rsi.actions = new String[5]; rsi.spritesX = new int[20]; @@ -2643,7 +2226,7 @@ public static void addBankItem(int index, Boolean hasOption) rsi.childX = new int[0]; rsi.childY = new int[0]; - //rsi.hasExamine = false; + // rsi.hasExamine = false; rsi.spritePaddingX = 24; rsi.spritePaddingY = 24; @@ -2687,7 +2270,6 @@ public static void addHoverImage(int i, int j, int k, String name) { tab.enabledSprite = imageLoader(k, name); } - public static Widget addTabInterface(int id) { Widget tab = interfaceCache[id] = new Widget(); tab.id = id;// 250 @@ -2719,7 +2301,7 @@ public static Widget addTabInterface(int id, Widget toClone) { } private static Sprite imageLoader(int i, String s) { - long l = (StringUtils.hashSpriteName(s) << 8) + (long) i; + long l = (StringUtils.hashSpriteName(s) << 8) + i; Sprite sprite = (Sprite) spriteCache.get(l); if (sprite != null) return sprite; @@ -2779,7 +2361,7 @@ private Model getModel(int type, int mobId) { } private static Sprite getSprite(int i, FileArchive streamLoader, String s) { - long l = (StringUtils.hashSpriteName(s) << 8) + (long) i; + long l = (StringUtils.hashSpriteName(s) << 8) + i; Sprite sprite = (Sprite) spriteCache.get(l); if (sprite != null) return sprite; @@ -2893,12 +2475,12 @@ public Widget() { public int modelRotation1; public int modelRotation2; public int childY[]; - + private static final int LUNAR_RUNE_SPRITES_START = 232; private static final int LUNAR_OFF_SPRITES_START = 246; private static final int LUNAR_ON_SPRITES_START = 285; private static final int LUNAR_HOVER_BOX_SPRITES_START = 324; - + public static void addLunarHoverBox(int interface_id, int spriteOffset) { Widget RSInterface = addInterface(interface_id); RSInterface.id = interface_id; @@ -2913,7 +2495,7 @@ public static void addLunarHoverBox(int interface_id, int spriteOffset) { RSInterface.height = 500; RSInterface.tooltip = ""; } - + public static void addLunarRune(int i, int spriteOffset, String runeName) { Widget RSInterface = addInterface(i); RSInterface.type = 5; @@ -2993,9 +2575,9 @@ public static void addLunar2RunesSmallBox(int ID, int r1, int r2, int ra1, int r rsInterface.valueIndexArray[2][0] = 1; rsInterface.valueIndexArray[2][1] = 6; rsInterface.valueIndexArray[2][2] = 0; - rsInterface.enabledSprite = Client.cacheSprite[LUNAR_ON_SPRITES_START+ spriteOffset]; - rsInterface.disabledSprite = Client.cacheSprite[LUNAR_OFF_SPRITES_START+ spriteOffset]; - + rsInterface.enabledSprite = Client.cacheSprite[LUNAR_ON_SPRITES_START + spriteOffset]; + rsInterface.disabledSprite = Client.cacheSprite[LUNAR_OFF_SPRITES_START + spriteOffset]; + Widget hover = addInterface(ID + 1); hover.parent = ID; hover.hoverType = -1; @@ -3063,9 +2645,9 @@ public static void addLunar3RunesSmallBox(int ID, int r1, int r2, int r3, int ra rsInterface.valueIndexArray[3][0] = 1; rsInterface.valueIndexArray[3][1] = 6; rsInterface.valueIndexArray[3][2] = 0; - rsInterface.enabledSprite = Client.cacheSprite[LUNAR_ON_SPRITES_START+ spriteOffset]; - rsInterface.disabledSprite = Client.cacheSprite[LUNAR_OFF_SPRITES_START+ spriteOffset]; - + rsInterface.enabledSprite = Client.cacheSprite[LUNAR_ON_SPRITES_START + spriteOffset]; + rsInterface.disabledSprite = Client.cacheSprite[LUNAR_OFF_SPRITES_START + spriteOffset]; + Widget hover = addInterface(ID + 1); hover.parent = ID; hover.hoverType = -1; @@ -3136,9 +2718,9 @@ public static void addLunar3RunesBigBox(int ID, int r1, int r2, int r3, int ra1, rsInterface.valueIndexArray[3][0] = 1; rsInterface.valueIndexArray[3][1] = 6; rsInterface.valueIndexArray[3][2] = 0; - rsInterface.enabledSprite = Client.cacheSprite[LUNAR_ON_SPRITES_START+ spriteOffset]; - rsInterface.disabledSprite = Client.cacheSprite[LUNAR_OFF_SPRITES_START+ spriteOffset]; - + rsInterface.enabledSprite = Client.cacheSprite[LUNAR_ON_SPRITES_START + spriteOffset]; + rsInterface.disabledSprite = Client.cacheSprite[LUNAR_OFF_SPRITES_START + spriteOffset]; + Widget hover = addInterface(ID + 1); hover.parent = ID; hover.hoverType = -1; @@ -3209,8 +2791,8 @@ public static void addLunar3RunesLargeBox(int ID, int r1, int r2, int r3, int ra rsInterface.valueIndexArray[3][0] = 1; rsInterface.valueIndexArray[3][1] = 6; rsInterface.valueIndexArray[3][2] = 0; - rsInterface.enabledSprite = Client.cacheSprite[LUNAR_ON_SPRITES_START+ spriteOffset]; - rsInterface.disabledSprite = Client.cacheSprite[LUNAR_OFF_SPRITES_START+ spriteOffset]; + rsInterface.enabledSprite = Client.cacheSprite[LUNAR_ON_SPRITES_START + spriteOffset]; + rsInterface.disabledSprite = Client.cacheSprite[LUNAR_OFF_SPRITES_START + spriteOffset]; Widget hover = addInterface(ID + 1); hover.parent = ID; hover.hoverType = -1; @@ -3236,206 +2818,204 @@ public static void addLunar3RunesLargeBox(int ID, int r1, int r2, int r3, int ra setBounds(ID + 7, 142, 92, 8, hover); } - public static void configureLunar(GameFont[] tda) { + public static void configureLunar(GameFont[] TDA) { constructLunar(); - addLunarRune(30003, 0, "Fire"); - addLunarRune(30004, 1, "Water"); - addLunarRune(30005, 2, "Air"); - addLunarRune(30006, 3, "Earth"); - addLunarRune(30007, 4, "Mind"); - addLunarRune(30008, 5, "Body"); - addLunarRune(30009, 6, "Death"); - addLunarRune(30010, 7, "Nature"); - addLunarRune(30011, 8, "Chaos"); - addLunarRune(30012, 9, "Law"); - addLunarRune(30013, 10, "Cosmic"); - addLunarRune(30014, 11, "Blood"); - addLunarRune(30015, 12, "Soul"); - addLunarRune(30016, 13, "Astral"); - + addLunarRune(30003, 1, "Fire"); + addLunarRune(30004, 2, "Water"); + addLunarRune(30005, 3, "Air"); + addLunarRune(30006, 4, "Earth"); + addLunarRune(30007, 5, "Mind"); + addLunarRune(30008, 6, "Body"); + addLunarRune(30009, 7, "Death"); + addLunarRune(30010, 8, "Nature"); + addLunarRune(30011, 9, "Chaos"); + addLunarRune(30012, 10, "Law"); + addLunarRune(30013, 11, "Cosmic"); + addLunarRune(30014, 12, "Blood"); + addLunarRune(30015, 13, "Soul"); + addLunarRune(30016, 14, "Astral"); addLunar3RunesSmallBox(30017, 9075, 554, 555, 0, 4, 3, 30003, 30004, 64, "Bake Pie", - "Bake pies without a stove", tda, 0, 16, 2); - addLunar2RunesSmallBox(30025, 9075, 557, 0, 7, 30006, 65, "Cure Plant", "Cure disease on farming patch", tda, 1, + "Bake pies without a stove", TDA, 0, 16, 2); + addLunar2RunesSmallBox(30025, 9075, 557, 0, 7, 30006, 65, "Cure Plant", "Cure disease on farming patch", TDA, 1, 4, 2); addLunar3RunesBigBox(30032, 9075, 564, 558, 0, 0, 0, 30013, 30007, 65, "Monster Examine", - "Detect the combat statistics of a\\nmonster", tda, 2, 2, 2); + "Detect the combat statistics of a\\nmonster", TDA, 2, 2, 2); addLunar3RunesSmallBox(30040, 9075, 564, 556, 0, 0, 1, 30013, 30005, 66, "NPC Contact", - "Speak with varied NPCs", tda, 3, 0, 2); + "Speak with varied NPCs", TDA, 3, 0, 2); addLunar3RunesSmallBox(30048, 9075, 563, 557, 0, 0, 9, 30012, 30006, 67, "Cure Other", "Cure poisoned players", - tda, 4, 8, 2); + TDA, 4, 8, 2); addLunar3RunesSmallBox(30056, 9075, 555, 554, 0, 2, 0, 30004, 30003, 67, "Humidify", - "Fills certain vessels with water", tda, 5, 0, 5); + "Fills certain vessels with water", TDA, 5, 0, 5); addLunar3RunesSmallBox(30064, 9075, 563, 557, 1, 0, 1, 30012, 30006, 68, "Moonclan Teleport", - "Teleports you to moonclan island", tda, 6, 0, 5); + "Teleports you to moonclan island", TDA, 6, 0, 5); addLunar3RunesBigBox(30075, 9075, 563, 557, 1, 0, 3, 30012, 30006, 69, "Tele Group Moonclan", - "Teleports players to Moonclan\\nisland", tda, 7, 0, 5); + "Teleports players to Moonclan\\nisland", TDA, 7, 0, 5); addLunar3RunesSmallBox(30083, 9075, 563, 557, 1, 0, 5, 30012, 30006, 70, "Ourania Teleport", - "Teleports you to ourania rune altar", tda, 8, 0, 5); - addLunar3RunesSmallBox(30091, 9075, 564, 563, 1, 1, 0, 30013, 30012, 70, "Cure Me", "Cures Poison", tda, 9, 0, + "Teleports you to ourania rune altar", TDA, 8, 0, 5); + addLunar3RunesSmallBox(30091, 9075, 564, 563, 1, 1, 0, 30013, 30012, 70, "Cure Me", "Cures Poison", TDA, 9, 0, 5); - addLunar2RunesSmallBox(30099, 9075, 557, 1, 1, 30006, 70, "Hunter Kit", "Get a kit of hunting gear", tda, 10, 0, + addLunar2RunesSmallBox(30099, 9075, 557, 1, 1, 30006, 70, "Hunter Kit", "Get a kit of hunting gear", TDA, 10, 0, 5); addLunar3RunesSmallBox(30106, 9075, 563, 555, 1, 0, 0, 30012, 30004, 71, "Waterbirth Teleport", - "Teleports you to Waterbirth island", tda, 11, 0, 5); + "Teleports you to Waterbirth island", TDA, 11, 0, 5); addLunar3RunesBigBox(30114, 9075, 563, 555, 1, 0, 4, 30012, 30004, 72, "Tele Group Waterbirth", - "Teleports players to Waterbirth\\nisland", tda, 12, 0, 5); + "Teleports players to Waterbirth\\nisland", TDA, 12, 0, 5); addLunar3RunesSmallBox(30122, 9075, 564, 563, 1, 1, 1, 30013, 30012, 73, "Cure Group", - "Cures Poison on players", tda, 13, 0, 5); + "Cures Poison on players", TDA, 13, 0, 5); addLunar3RunesBigBox(30130, 9075, 564, 559, 1, 1, 4, 30013, 30008, 74, "Stat Spy", - "Cast on another player to see their\\nskill levels", tda, 14, 8, 2); + "Cast on another player to see their\\nskill levels", TDA, 14, 8, 2); addLunar3RunesBigBox(30138, 9075, 563, 554, 1, 1, 2, 30012, 30003, 74, "Barbarian Teleport", - "Teleports you to the Barbarian\\noutpost", tda, 15, 0, 5); + "Teleports you to the Barbarian\\noutpost", TDA, 15, 0, 5); addLunar3RunesBigBox(30146, 9075, 563, 554, 1, 1, 5, 30012, 30003, 75, "Tele Group Barbarian", - "Teleports players to the Barbarian\\noutpost", tda, 16, 0, 5); + "Teleports players to the Barbarian\\noutpost", TDA, 16, 0, 5); addLunar3RunesSmallBox(30154, 9075, 554, 556, 1, 5, 9, 30003, 30005, 76, "Superglass Make", - "Make glass without a furnace", tda, 17, 16, 2); + "Make glass without a furnace", TDA, 17, 16, 2); addLunar3RunesSmallBox(30162, 9075, 563, 555, 1, 1, 3, 30012, 30004, 77, "Khazard Teleport", - "Teleports you to Port khazard", tda, 18, 0, 5); + "Teleports you to Port khazard", TDA, 18, 0, 5); addLunar3RunesSmallBox(30170, 9075, 563, 555, 1, 1, 7, 30012, 30004, 78, "Tele Group Khazard", - "Teleports players to Port khazard", tda, 19, 0, 5); + "Teleports players to Port khazard", TDA, 19, 0, 5); addLunar3RunesBigBox(30178, 9075, 564, 559, 1, 0, 4, 30013, 30008, 78, "Dream", - "Take a rest and restore hitpoints 3\\n times faster", tda, 20, 0, 5); + "Take a rest and restore hitpoints 3\\n times faster", TDA, 20, 0, 5); addLunar3RunesSmallBox(30186, 9075, 557, 555, 1, 9, 4, 30006, 30004, 79, "String Jewellery", - "String amulets without wool", tda, 21, 0, 5); + "String amulets without wool", TDA, 21, 0, 5); addLunar3RunesLargeBox(30194, 9075, 557, 555, 1, 9, 9, 30006, 30004, 80, "Stat Restore Pot\\nShare", - "Share a potion with up to 4 nearby\\nplayers", tda, 22, 0, 5); + "Share a potion with up to 4 nearby\\nplayers", TDA, 22, 0, 5); addLunar3RunesSmallBox(30202, 9075, 554, 555, 1, 6, 6, 30003, 30004, 81, "Magic Imbue", - "Combine runes without a talisman", tda, 23, 0, 5); + "Combine runes without a talisman", TDA, 23, 0, 5); addLunar3RunesBigBox(30210, 9075, 561, 557, 2, 1, 14, 30010, 30006, 82, "Fertile Soil", - "Fertilise a farming patch with super\\ncompost", tda, 24, 4, 2); + "Fertilise a farming patch with super\\ncompost", TDA, 24, 4, 2); addLunar3RunesBigBox(30218, 9075, 557, 555, 2, 11, 9, 30006, 30004, 83, "Boost Potion Share", - "Shares a potion with up to 4 nearby\\nplayers", tda, 25, 0, 5); + "Shares a potion with up to 4 nearby\\nplayers", TDA, 25, 0, 5); addLunar3RunesSmallBox(30226, 9075, 563, 555, 2, 2, 9, 30012, 30004, 84, "Fishing Guild Teleport", - "Teleports you to the fishing guild", tda, 26, 0, 5); + "Teleports you to the fishing guild", TDA, 26, 0, 5); addLunar3RunesLargeBox(30234, 9075, 563, 555, 1, 2, 13, 30012, 30004, 85, "Tele Group Fishing Guild", - "Teleports players to the Fishing\\nGuild", tda, 27, 0, 5); + "Teleports players to the Fishing\\nGuild", TDA, 27, 0, 5); addLunar3RunesSmallBox(30242, 9075, 557, 561, 2, 14, 0, 30006, 30010, 85, "Plank Make", "Turn Logs into planks", - tda, 28, 16, 5); + TDA, 28, 16, 5); addLunar3RunesSmallBox(30250, 9075, 563, 555, 2, 2, 9, 30012, 30004, 86, "Catherby Teleport", - "Teleports you to Catherby", tda, 29, 0, 5); + "Teleports you to Catherby", TDA, 29, 0, 5); addLunar3RunesSmallBox(30258, 9075, 563, 555, 2, 2, 14, 30012, 30004, 87, "Tele Group Catherby", - "Teleports players to Catherby", tda, 30, 0, 5); + "Teleports players to Catherby", TDA, 30, 0, 5); addLunar3RunesSmallBox(30266, 9075, 563, 555, 2, 2, 7, 30012, 30004, 88, "Ice Plateau Teleport", - "Teleports you to Ice Plateau", tda, 31, 0, 5); + "Teleports you to Ice Plateau", TDA, 31, 0, 5); addLunar3RunesLargeBox(30274, 9075, 563, 555, 2, 2, 15, 30012, 30004, 89, "Tele Group Ice Plateau", - "Teleports players to Ice Plateau", tda, 32, 0, 5); + "Teleports players to Ice Plateau", TDA, 32, 0, 5); addLunar3RunesBigBox(30282, 9075, 563, 561, 2, 1, 0, 30012, 30010, 90, "Energy Transfer", - "Spend HP and SA energy to\\n give another SA and run energy", tda, 33, 8, 2); + "Spend HP and SA energy to\\n give another SA and run energy", TDA, 33, 8, 2); addLunar3RunesBigBox(30290, 9075, 563, 565, 2, 2, 0, 30012, 30014, 91, "Heal Other", - "Transfer up to 75% of hitpoints\\n to another player", tda, 34, 8, 2); + "Transfer up to 75% of hitpoints\\n to another player", TDA, 34, 8, 2); addLunar3RunesBigBox(30298, 9075, 560, 557, 2, 1, 9, 30009, 30006, 92, "Vengeance Other", - "Allows another player to rebound\\ndamage to an opponent", tda, 35, 8, 2); + "Allows another player to rebound\\ndamage to an opponent", TDA, 35, 8, 2); addLunar3RunesSmallBox(30306, 9075, 560, 557, 3, 1, 9, 30009, 30006, 93, "Vengeance", - "Rebound damage to an opponent", tda, 36, 0, 5); + "Rebound damage to an opponent", TDA, 36, 0, 5); addLunar3RunesBigBox(30314, 9075, 565, 563, 3, 2, 5, 30014, 30012, 94, "Heal Group", - "Transfer up to 75% of hitpoints\\n to a group", tda, 37, 0, 5); + "Transfer up to 75% of hitpoints\\n to a group", TDA, 37, 0, 5); addLunar3RunesBigBox(30322, 9075, 564, 563, 2, 1, 0, 30013, 30012, 95, "Spellbook Swap", - "Change to another spellbook for 1\\nspell cast", tda, 38, 0, 5); + "Change to another spellbook for 1\\nspell cast", TDA, 38, 0, 5); } public static void constructLunar() { Widget Interface = addTabInterface(29999); setChildren(51, Interface); // 50 children int child = 0; - - //ADD "HOME" AND "OTHER" TELEPORTS + + // ADD "HOME" AND "OTHER" TELEPORTS setBounds(39101, 10, 9, child++, Interface); setBounds(39102, 10, 9, child++, Interface); setBounds(39104, 105, 9, child++, Interface); setBounds(39105, 105, 9, child++, Interface); - - - //NOTE: Lunar Teleports have been removed from the spellbook (the ones that are commented out are teleports) - - //Row 1 + + // NOTE: Lunar Teleports have been removed from the spellbook (the ones + // that are commented out are teleports) + + // Row 1 setBounds(30017, 20, 60, child++, Interface); setBounds(30025, 61, 62, child++, Interface); setBounds(30032, 102, 61, child++, Interface); setBounds(30040, 142, 62, child++, Interface); - - //Row 2 + + // Row 2 setBounds(30048, 20, 93, child++, Interface); setBounds(30056, 60, 92, child++, Interface); setBounds(30091, 102, 92, child++, Interface); setBounds(30099, 142, 90, child++, Interface); - - //Row 3 + + // Row 3 setBounds(30122, 20, 123, child++, Interface); setBounds(30130, 62, 123, child++, Interface); setBounds(30154, 106, 123, child++, Interface); setBounds(30154, 147, 123, child++, Interface); - //Row 4 + // Row 4 setBounds(30178, 19, 154, child++, Interface); setBounds(30186, 63, 155, child++, Interface); setBounds(30194, 106, 155, child++, Interface); setBounds(30202, 145, 155, child++, Interface); - - //Row 5 + + // Row 5 setBounds(30210, 21, 184, child++, Interface); setBounds(30218, 66, 186, child++, Interface); setBounds(30282, 105, 184, child++, Interface); setBounds(30290, 145, 183, child++, Interface); - - //Row 6 + + // Row 6 setBounds(30298, 23, 214, child++, Interface); setBounds(30306, 66, 214, child++, Interface); setBounds(30314, 105, 214, child++, Interface); setBounds(30322, 147, 214, child++, Interface); - - - //setBounds(30064, 39, 39, child++, Interface); - //setBounds(30075, 71, 39, child++, Interface); - //setBounds(30083, 103, 39, child++, Interface); - //setBounds(30106, 12, 68, child++, Interface); - // setBounds(30114, 42, 68, child++, Interface); - // setBounds(30138, 135, 68, child++, Interface); - // setBounds(30146, 165, 68, child++, Interface); - // setBounds(30162, 42, 97, child++, Interface); - // setBounds(30170, 71, 97, child++, Interface); - - // setBounds(30226, 103, 125, child++, Interface); - // setBounds(30234, 135, 125, child++, Interface); - // setBounds(30242, 164, 126, child++, Interface); - // setBounds(30250, 10, 155, child++, Interface); - // setBounds(30258, 42, 155, child++, Interface); - // setBounds(30266, 71, 155, child++, Interface); - // setBounds(30274, 103, 155, child++, Interface); - + + // setBounds(30064, 39, 39, child++, Interface); + // setBounds(30075, 71, 39, child++, Interface); + // setBounds(30083, 103, 39, child++, Interface); + // setBounds(30106, 12, 68, child++, Interface); + // setBounds(30114, 42, 68, child++, Interface); + // setBounds(30138, 135, 68, child++, Interface); + // setBounds(30146, 165, 68, child++, Interface); + // setBounds(30162, 42, 97, child++, Interface); + // setBounds(30170, 71, 97, child++, Interface); + + // setBounds(30226, 103, 125, child++, Interface); + // setBounds(30234, 135, 125, child++, Interface); + // setBounds(30242, 164, 126, child++, Interface); + // setBounds(30250, 10, 155, child++, Interface); + // setBounds(30258, 42, 155, child++, Interface); + // setBounds(30266, 71, 155, child++, Interface); + // setBounds(30274, 103, 155, child++, Interface); + setBounds(30018, 5, 176, child++, Interface);// hover setBounds(30026, 5, 176, child++, Interface);// hover setBounds(30033, 5, 163, child++, Interface);// hover setBounds(30041, 5, 176, child++, Interface);// hover setBounds(30049, 5, 176, child++, Interface);// hover setBounds(30057, 5, 176, child++, Interface);// hover - //setBounds(30065, 5, 176, child++, Interface);// hover - //setBounds(30076, 5, 163, child++, Interface);// hover - //setBounds(30084, 5, 176, child++, Interface);// hover + // setBounds(30065, 5, 176, child++, Interface);// hover + // setBounds(30076, 5, 163, child++, Interface);// hover + // setBounds(30084, 5, 176, child++, Interface);// hover setBounds(30092, 5, 176, child++, Interface);// hover setBounds(30100, 5, 176, child++, Interface);// hover - // setBounds(30107, 5, 176, child++, Interface);// hover - // setBounds(30115, 5, 163, child++, Interface);// hover + // setBounds(30107, 5, 176, child++, Interface);// hover + // setBounds(30115, 5, 163, child++, Interface);// hover setBounds(30123, 5, 176, child++, Interface);// hover setBounds(30131, 5, 163, child++, Interface);// hover - // setBounds(30139, 5, 163, child++, Interface);// hover - // setBounds(30147, 5, 163, child++, Interface);// hover + // setBounds(30139, 5, 163, child++, Interface);// hover + // setBounds(30147, 5, 163, child++, Interface);// hover setBounds(30155, 5, 176, child++, Interface);// hover - // setBounds(30163, 5, 176, child++, Interface);// hover - // setBounds(30171, 5, 176, child++, Interface);// hover + // setBounds(30163, 5, 176, child++, Interface);// hover + // setBounds(30171, 5, 176, child++, Interface);// hover setBounds(30179, 5, 40, child++, Interface);// hover setBounds(30187, 5, 40, child++, Interface);// hover setBounds(30195, 5, 40, child++, Interface);// hover setBounds(30203, 5, 40, child++, Interface);// hover setBounds(30211, 5, 40, child++, Interface);// hover setBounds(30219, 5, 40, child++, Interface);// hover - - // setBounds(30227, 5, 176, child++, Interface);// hover - // setBounds(30235, 5, 149, child++, Interface);// hover - // setBounds(30243, 5, 176, child++, Interface);// hover - // setBounds(30251, 5, 5, child++, Interface);// hover - // setBounds(30259, 5, 5, child++, Interface);// hover - // setBounds(30267, 5, 5, child++, Interface);// hover - // setBounds(30275, 5, 5, child++, Interface);// hover + + // setBounds(30227, 5, 176, child++, Interface);// hover + // setBounds(30235, 5, 149, child++, Interface);// hover + // setBounds(30243, 5, 176, child++, Interface);// hover + // setBounds(30251, 5, 5, child++, Interface);// hover + // setBounds(30259, 5, 5, child++, Interface);// hover + // setBounds(30267, 5, 5, child++, Interface);// hover + // setBounds(30275, 5, 5, child++, Interface);// hover setBounds(30283, 5, 40, child++, Interface);// hover setBounds(30291, 5, 40, child++, Interface);// hover setBounds(30299, 5, 40, child++, Interface);// hover @@ -3449,7 +3029,7 @@ public static void setChildren(int total, Widget i) { i.childX = new int[total]; i.childY = new int[total]; } - + public static void setBounds(int ID, int X, int Y, int frame, Widget r) { r.children[frame] = ID; r.childX[frame] = X; @@ -3472,7 +3052,6 @@ public static void addButton(int i, int j, String name, int W, int H, String S, RSInterface.tooltip = S; } - public static void addSprites(int ID, int i, int i2, String name, int configId, int configFrame) { Widget Tab = addTabInterface(ID); Tab.id = ID; @@ -3495,22 +3074,22 @@ public static void addSprites(int ID, int i, int i2, String name, int configId, Tab.disabledSprite = imageLoader(i, name); Tab.enabledSprite = imageLoader(i2, name); } - + private static void specialBars() { - for(int id : SPECIAL_BARS) { + for (int id : SPECIAL_BARS) { specialBar(id); } } - + private static void specialBar(int id) // 7599 { - // addActionButton(id - 12, 70, -1, 150, 26, "Use @gre@Special Attack"); + // addActionButton(id - 12, 70, -1, 150, 26, "Use @gre@Special Attack"); for (int i = id - 11; i < id; i++) { removeSomething(i); } - - System.out.println("Broken: "+id); + + System.out.println("Broken: " + id); Widget rsi = interfaceCache[id - 12]; rsi.width = 150; diff --git a/Elvarg - Client/src/com/runescape/collection/Deque.java b/Elvarg - Client/src/com/runescape/collection/Deque.java index 894d7dc..89a5c3f 100644 --- a/Elvarg - Client/src/com/runescape/collection/Deque.java +++ b/Elvarg - Client/src/com/runescape/collection/Deque.java @@ -1,7 +1,7 @@ package com.runescape.collection; public final class Deque { - + private final Linkable head; private Linkable current; diff --git a/Elvarg - Client/src/com/runescape/collection/HashTable.java b/Elvarg - Client/src/com/runescape/collection/HashTable.java index 6b1a06a..fa24434 100644 --- a/Elvarg - Client/src/com/runescape/collection/HashTable.java +++ b/Elvarg - Client/src/com/runescape/collection/HashTable.java @@ -31,7 +31,7 @@ public HashTable() { * an associated for the specified key. */ public Linkable get(long key) { - Linkable linkable = buckets[(int) (key & (long) (bucketCount - 1))]; + Linkable linkable = buckets[(int) (key & bucketCount - 1)]; for (Linkable next = linkable.previous; next != linkable; next = next.previous) if (next.key == key) return next; @@ -51,7 +51,7 @@ public void put(Linkable linkable, long key) { try { if (linkable.next != null) linkable.unlink(); - Linkable current = buckets[(int) (key & (long) (bucketCount - 1))]; + Linkable current = buckets[(int) (key & bucketCount - 1)]; linkable.next = current.next; linkable.previous = current; linkable.next.previous = linkable; @@ -59,8 +59,8 @@ public void put(Linkable linkable, long key) { linkable.key = key; return; } catch (RuntimeException runtimeexception) { - SignLink.reporterror("91499, " + linkable + ", " + key + ", " - + (byte) 7 + ", " + runtimeexception.toString()); + SignLink.reporterror( + "91499, " + linkable + ", " + key + ", " + (byte) 7 + ", " + runtimeexception.toString()); } throw new RuntimeException(); } diff --git a/Elvarg - Client/src/com/runescape/collection/Linkable.java b/Elvarg - Client/src/com/runescape/collection/Linkable.java index b7569f3..47a196a 100644 --- a/Elvarg - Client/src/com/runescape/collection/Linkable.java +++ b/Elvarg - Client/src/com/runescape/collection/Linkable.java @@ -1,7 +1,7 @@ package com.runescape.collection; public class Linkable { - + public long key; public Linkable previous; public Linkable next; diff --git a/Elvarg - Client/src/com/runescape/collection/ReferenceCache.java b/Elvarg - Client/src/com/runescape/collection/ReferenceCache.java index 6f871e2..7b8500a 100644 --- a/Elvarg - Client/src/com/runescape/collection/ReferenceCache.java +++ b/Elvarg - Client/src/com/runescape/collection/ReferenceCache.java @@ -1,11 +1,13 @@ package com.runescape.collection; + import com.runescape.sign.SignLink; /** - * A least-recently used cache of references, backed by a {@link HashTable} and a {@link Queue}. + * A least-recently used cache of references, backed by a {@link HashTable} and + * a {@link Queue}. */ public final class ReferenceCache { - + /** * The empty cacheable. */ @@ -30,7 +32,8 @@ public final class ReferenceCache { /** * Creates the ReferenceCache. * - * @param capacity The capacity of this cache. + * @param capacity + * The capacity of this cache. */ public ReferenceCache(int i) { empty = new Cacheable(); @@ -43,7 +46,8 @@ public ReferenceCache(int i) { /** * Gets the {@link Cacheable} with the specified key. * - * @param key The key. + * @param key + * The key. * @return The Cacheable. */ public Cacheable get(long key) { @@ -76,7 +80,7 @@ public void put(Cacheable node, long key) { } throw new RuntimeException(); } - + /** * Clears the contents of this ReferenceCache. */ diff --git a/Elvarg - Client/src/com/runescape/draw/ProducingGraphicsBuffer.java b/Elvarg - Client/src/com/runescape/draw/ProducingGraphicsBuffer.java index 9b86f18..735e301 100644 --- a/Elvarg - Client/src/com/runescape/draw/ProducingGraphicsBuffer.java +++ b/Elvarg - Client/src/com/runescape/draw/ProducingGraphicsBuffer.java @@ -1,5 +1,6 @@ package com.runescape.draw; -import java.awt.*; + +import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; @@ -10,11 +11,11 @@ public final class ProducingGraphicsBuffer { public final int canvasHeight; private final BufferedImage bufferedImage; private float[] depthbuffer; - + public ProducingGraphicsBuffer(int canvasWidth, int canvasHeight) { this.canvasWidth = canvasWidth; this.canvasHeight = canvasHeight; - depthbuffer = new float [canvasWidth * canvasHeight]; + depthbuffer = new float[canvasWidth * canvasHeight]; bufferedImage = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB); canvasRaster = ((DataBufferInt) bufferedImage.getRaster().getDataBuffer()).getData(); initDrawingArea(); diff --git a/Elvarg - Client/src/com/runescape/draw/Rasterizer2D.java b/Elvarg - Client/src/com/runescape/draw/Rasterizer2D.java index c011c20..51fbc22 100644 --- a/Elvarg - Client/src/com/runescape/draw/Rasterizer2D.java +++ b/Elvarg - Client/src/com/runescape/draw/Rasterizer2D.java @@ -1,14 +1,21 @@ package com.runescape.draw; + import com.runescape.collection.Cacheable; public class Rasterizer2D extends Cacheable { - /** - * Sets the Rasterizer2D in the upper left corner with height, width and pixels set. - * @param height The height of the drawingArea. - * @param width The width of the drawingArea. - * @param pixels The array of pixels (RGBColours) in the drawingArea. - * @param depth An array of fog depths. - */ + /** + * Sets the Rasterizer2D in the upper left corner with height, width and + * pixels set. + * + * @param height + * The height of the drawingArea. + * @param width + * The width of the drawingArea. + * @param pixels + * The array of pixels (RGBColours) in the drawingArea. + * @param depth + * An array of fog depths. + */ public static void initDrawingArea(int height, int width, int pixels[], float depth[]) { depthBuffer = depth; Rasterizer2D.pixels = pixels; @@ -17,43 +24,56 @@ public static void initDrawingArea(int height, int width, int pixels[], float de setDrawingArea(height, 0, width, 0); } - /** - * Draws a transparent box with a gradient that changes from top to bottom. - * @param leftX The left edge X-Coordinate of the box. - * @param topY The top edge Y-Coordinate of the box. - * @param width The width of the box. - * @param height The height of the box. - * @param topColour The top rgbColour of the gradient. - * @param bottomColour The bottom rgbColour of the gradient. - * @param opacity The opacity value ranging from 0 to 256. - */ - public static void drawTransparentGradientBox(int leftX, int topY, int width, int height, int topColour, int bottomColour, int opacity) { + /** + * Draws a transparent box with a gradient that changes from top to bottom. + * + * @param leftX + * The left edge X-Coordinate of the box. + * @param topY + * The top edge Y-Coordinate of the box. + * @param width + * The width of the box. + * @param height + * The height of the box. + * @param topColour + * The top rgbColour of the gradient. + * @param bottomColour + * The bottom rgbColour of the gradient. + * @param opacity + * The opacity value ranging from 0 to 256. + */ + public static void drawTransparentGradientBox(int leftX, int topY, int width, int height, int topColour, + int bottomColour, int opacity) { int gradientProgress = 0; int progressPerPixel = 0x10000 / height; - if(leftX < Rasterizer2D.leftX) { + if (leftX < Rasterizer2D.leftX) { width -= Rasterizer2D.leftX - leftX; leftX = Rasterizer2D.leftX; } - if(topY < Rasterizer2D.topY) { + if (topY < Rasterizer2D.topY) { gradientProgress += (Rasterizer2D.topY - topY) * progressPerPixel; height -= Rasterizer2D.topY - topY; topY = Rasterizer2D.topY; } - if(leftX + width > bottomX) + if (leftX + width > bottomX) width = bottomX - leftX; - if(topY + height > bottomY) + if (topY + height > bottomY) height = bottomY - topY; int leftOver = Rasterizer2D.width - width; int transparency = 256 - opacity; int pixelIndex = leftX + topY * Rasterizer2D.width; - for(int rowIndex = 0; rowIndex < height; rowIndex++) { + for (int rowIndex = 0; rowIndex < height; rowIndex++) { int gradient = 0x10000 - gradientProgress >> 8; int inverseGradient = gradientProgress >> 8; - int gradientColour = ((topColour & 0xff00ff) * gradient + (bottomColour & 0xff00ff) * inverseGradient & 0xff00ff00) + ((topColour & 0xff00) * gradient + (bottomColour & 0xff00) * inverseGradient & 0xff0000) >>> 8; - int transparentPixel = ((gradientColour & 0xff00ff) * opacity >> 8 & 0xff00ff) + ((gradientColour & 0xff00) * opacity >> 8 & 0xff00); - for(int columnIndex = 0; columnIndex < width; columnIndex++) { + int gradientColour = ((topColour & 0xff00ff) * gradient + (bottomColour & 0xff00ff) * inverseGradient + & 0xff00ff00) + + ((topColour & 0xff00) * gradient + (bottomColour & 0xff00) * inverseGradient & 0xff0000) >>> 8; + int transparentPixel = ((gradientColour & 0xff00ff) * opacity >> 8 & 0xff00ff) + + ((gradientColour & 0xff00) * opacity >> 8 & 0xff00); + for (int columnIndex = 0; columnIndex < width; columnIndex++) { int backgroundPixel = pixels[pixelIndex]; - backgroundPixel = ((backgroundPixel & 0xff00ff) * transparency >> 8 & 0xff00ff) + ((backgroundPixel & 0xff00) * transparency >> 8 & 0xff00); + backgroundPixel = ((backgroundPixel & 0xff00ff) * transparency >> 8 & 0xff00ff) + + ((backgroundPixel & 0xff00) * transparency >> 8 & 0xff00); pixels[pixelIndex++] = transparentPixel + backgroundPixel; } pixelIndex += leftOver; @@ -61,11 +81,10 @@ public static void drawTransparentGradientBox(int leftX, int topY, int width, in } } - /** - * Sets the drawingArea to the default size and position. - * Position: Upper left corner. - * Size: As specified before. - */ + /** + * Sets the drawingArea to the default size and position. Position: Upper + * left corner. Size: As specified before. + */ public static void defaultDrawingAreaSize() { leftX = 0; topY = 0; @@ -75,61 +94,72 @@ public static void defaultDrawingAreaSize() { viewportCenterX = bottomX / 2; } - /** - * Sets the drawingArea based on the coordinates of the edges. - * @param bottomY The bottom edge Y-Coordinate. - * @param leftX The left edge X-Coordinate. - * @param rightX The right edge X-Coordinate. - * @param topY The top edge Y-Coordinate. - */ + /** + * Sets the drawingArea based on the coordinates of the edges. + * + * @param bottomY + * The bottom edge Y-Coordinate. + * @param leftX + * The left edge X-Coordinate. + * @param rightX + * The right edge X-Coordinate. + * @param topY + * The top edge Y-Coordinate. + */ public static void setDrawingArea(int bottomY, int leftX, int rightX, int topY) { - if(leftX < 0) { - leftX = 0; + if (leftX < 0) { + leftX = 0; } - if(topY < 0) { - topY = 0; + if (topY < 0) { + topY = 0; } - if(rightX > width) { + if (rightX > width) { rightX = width; } - if(bottomY > height) { + if (bottomY > height) { bottomY = height; } Rasterizer2D.leftX = leftX; Rasterizer2D.topY = topY; bottomX = rightX; Rasterizer2D.bottomY = bottomY; - lastX = bottomX; - viewportCenterX = bottomX / 2; - viewportCenterY = Rasterizer2D.bottomY / 2; + lastX = bottomX; + viewportCenterX = bottomX / 2; + viewportCenterY = Rasterizer2D.bottomY / 2; } - /** - * Clears the drawingArea by setting every pixel to 0 (black). - */ - public static void clear() { + /** + * Clears the drawingArea by setting every pixel to 0 (black). + */ + public static void clear() { int i = width * height; - for(int j = 0; j < i; j++) { + for (int j = 0; j < i; j++) { pixels[j] = 0; depthBuffer[j] = Float.MAX_VALUE; } } - /** - * Draws a box filled with a certain colour. - * @param leftX The left edge X-Coordinate of the box. - * @param topY The top edge Y-Coordinate of the box. - * @param width The width of the box. - * @param height The height of the box. - * @param rgbColour The RGBColour of the box. - */ + /** + * Draws a box filled with a certain colour. + * + * @param leftX + * The left edge X-Coordinate of the box. + * @param topY + * The top edge Y-Coordinate of the box. + * @param width + * The width of the box. + * @param height + * The height of the box. + * @param rgbColour + * The RGBColour of the box. + */ public static void drawBox(int leftX, int topY, int width, int height, int rgbColour) { if (leftX < Rasterizer2D.leftX) { - width -= Rasterizer2D.leftX - leftX; + width -= Rasterizer2D.leftX - leftX; leftX = Rasterizer2D.leftX; } if (topY < Rasterizer2D.topY) { - height -= Rasterizer2D.topY - topY; + height -= Rasterizer2D.topY - topY; topY = Rasterizer2D.topY; } if (leftX + width > bottomX) @@ -145,27 +175,34 @@ public static void drawBox(int leftX, int topY, int width, int height, int rgbCo } } - /** - * Draws a transparent box. - * @param leftX The left edge X-Coordinate of the box. - * @param topY The top edge Y-Coordinate of the box. - * @param width The box width. - * @param height The box height. - * @param rgbColour The box colour. - * @param opacity The opacity value ranging from 0 to 256. - */ - public static void drawTransparentBox(int leftX, int topY, int width, int height, int rgbColour, int opacity){ - if(leftX < Rasterizer2D.leftX){ - width -= Rasterizer2D.leftX - leftX; + /** + * Draws a transparent box. + * + * @param leftX + * The left edge X-Coordinate of the box. + * @param topY + * The top edge Y-Coordinate of the box. + * @param width + * The box width. + * @param height + * The box height. + * @param rgbColour + * The box colour. + * @param opacity + * The opacity value ranging from 0 to 256. + */ + public static void drawTransparentBox(int leftX, int topY, int width, int height, int rgbColour, int opacity) { + if (leftX < Rasterizer2D.leftX) { + width -= Rasterizer2D.leftX - leftX; leftX = Rasterizer2D.leftX; } - if(topY < Rasterizer2D.topY){ - height -= Rasterizer2D.topY - topY; - topY = Rasterizer2D.topY; + if (topY < Rasterizer2D.topY) { + height -= Rasterizer2D.topY - topY; + topY = Rasterizer2D.topY; } - if(leftX + width > bottomX) + if (leftX + width > bottomX) width = bottomX - leftX; - if(topY + height > bottomY) + if (topY + height > bottomY) height = bottomY - topY; int transparency = 256 - opacity; int red = (rgbColour >> 16 & 0xff) * opacity; @@ -173,18 +210,19 @@ public static void drawTransparentBox(int leftX, int topY, int width, int height int blue = (rgbColour & 0xff) * opacity; int leftOver = Rasterizer2D.width - width; int pixelIndex = leftX + topY * Rasterizer2D.width; - for(int rowIndex = 0; rowIndex < height; rowIndex++){ - for(int columnIndex = 0; columnIndex < width; columnIndex++){ + for (int rowIndex = 0; rowIndex < height; rowIndex++) { + for (int columnIndex = 0; columnIndex < width; columnIndex++) { int otherRed = (pixels[pixelIndex] >> 16 & 0xff) * transparency; int otherGreen = (pixels[pixelIndex] >> 8 & 0xff) * transparency; int otherBlue = (pixels[pixelIndex] & 0xff) * transparency; - int transparentColour = ((red + otherRed >> 8) << 16) + ((green + otherGreen >> 8) << 8) + (blue + otherBlue >> 8); + int transparentColour = ((red + otherRed >> 8) << 16) + ((green + otherGreen >> 8) << 8) + + (blue + otherBlue >> 8); pixels[pixelIndex++] = transparentColour; } pixelIndex += leftOver; } } - + public static void drawPixels(int height, int posY, int posX, int color, int width) { if (posX < leftX) { width -= leftX - posX; @@ -210,99 +248,130 @@ public static void drawPixels(int height, int posY, int posX, int color, int wid l1 += k1; } } - - /** - * Draws a 1 pixel thick box outline in a certain colour. - * @param leftX The left edge X-Coordinate. - * @param topY The top edge Y-Coordinate. - * @param width The width. - * @param height The height. - * @param rgbColour The RGB-Colour. - */ - public static void drawBoxOutline(int leftX, int topY, int width, int height, int rgbColour){ + + /** + * Draws a 1 pixel thick box outline in a certain colour. + * + * @param leftX + * The left edge X-Coordinate. + * @param topY + * The top edge Y-Coordinate. + * @param width + * The width. + * @param height + * The height. + * @param rgbColour + * The RGB-Colour. + */ + public static void drawBoxOutline(int leftX, int topY, int width, int height, int rgbColour) { drawHorizontalLine(leftX, topY, width, rgbColour); drawHorizontalLine(leftX, (topY + height) - 1, width, rgbColour); drawVerticalLine(leftX, topY, height, rgbColour); drawVerticalLine((leftX + width) - 1, topY, height, rgbColour); } - /** - * Draws a coloured horizontal line in the drawingArea. - * @param xPosition The start X-Position of the line. - * @param yPosition The Y-Position of the line. - * @param width The width of the line. - * @param rgbColour The colour of the line. - */ - public static void drawHorizontalLine(int xPosition, int yPosition, int width, int rgbColour){ - if(yPosition < topY || yPosition >= bottomY) + /** + * Draws a coloured horizontal line in the drawingArea. + * + * @param xPosition + * The start X-Position of the line. + * @param yPosition + * The Y-Position of the line. + * @param width + * The width of the line. + * @param rgbColour + * The colour of the line. + */ + public static void drawHorizontalLine(int xPosition, int yPosition, int width, int rgbColour) { + if (yPosition < topY || yPosition >= bottomY) return; - if(xPosition < leftX){ + if (xPosition < leftX) { width -= leftX - xPosition; xPosition = leftX; } - if(xPosition + width > bottomX) - width = bottomX - xPosition; + if (xPosition + width > bottomX) + width = bottomX - xPosition; int pixelIndex = xPosition + yPosition * Rasterizer2D.width; - for(int i = 0; i < width; i++) + for (int i = 0; i < width; i++) pixels[pixelIndex + i] = rgbColour; } - /** - * Draws a coloured vertical line in the drawingArea. - * @param xPosition The X-Position of the line. - * @param yPosition The start Y-Position of the line. - * @param height The height of the line. - * @param rgbColour The colour of the line. - */ - public static void drawVerticalLine(int xPosition, int yPosition, int height, int rgbColour){ - if(xPosition < leftX || xPosition >= bottomX) + /** + * Draws a coloured vertical line in the drawingArea. + * + * @param xPosition + * The X-Position of the line. + * @param yPosition + * The start Y-Position of the line. + * @param height + * The height of the line. + * @param rgbColour + * The colour of the line. + */ + public static void drawVerticalLine(int xPosition, int yPosition, int height, int rgbColour) { + if (xPosition < leftX || xPosition >= bottomX) return; - if(yPosition < topY){ + if (yPosition < topY) { height -= topY - yPosition; yPosition = topY; } - if(yPosition + height > bottomY) + if (yPosition + height > bottomY) height = bottomY - yPosition; int pixelIndex = xPosition + yPosition * width; - for(int rowIndex = 0; rowIndex < height; rowIndex++) + for (int rowIndex = 0; rowIndex < height; rowIndex++) pixels[pixelIndex + rowIndex * width] = rgbColour; } - /** - * Draws a 1 pixel thick transparent box outline in a certain colour. - * @param leftX The left edge X-Coordinate - * @param topY The top edge Y-Coordinate. - * @param width The width. - * @param height The height. - * @param rgbColour The RGB-Colour. - * @param opacity The opacity value ranging from 0 to 256. - */ - public static void drawTransparentBoxOutline(int leftX, int topY, int width, int height, int rgbColour, int opacity) { + /** + * Draws a 1 pixel thick transparent box outline in a certain colour. + * + * @param leftX + * The left edge X-Coordinate + * @param topY + * The top edge Y-Coordinate. + * @param width + * The width. + * @param height + * The height. + * @param rgbColour + * The RGB-Colour. + * @param opacity + * The opacity value ranging from 0 to 256. + */ + public static void drawTransparentBoxOutline(int leftX, int topY, int width, int height, int rgbColour, + int opacity) { drawTransparentHorizontalLine(leftX, topY, width, rgbColour, opacity); drawTransparentHorizontalLine(leftX, topY + height - 1, width, rgbColour, opacity); - if(height >= 3) { + if (height >= 3) { drawTransparentVerticalLine(leftX, topY + 1, height - 2, rgbColour, opacity); drawTransparentVerticalLine(leftX + width - 1, topY + 1, height - 2, rgbColour, opacity); } } - /** - * Draws a transparent coloured horizontal line in the drawingArea. - * @param xPosition The start X-Position of the line. - * @param yPosition The Y-Position of the line. - * @param width The width of the line. - * @param rgbColour The colour of the line. - * @param opacity The opacity value ranging from 0 to 256. - */ - public static void drawTransparentHorizontalLine(int xPosition, int yPosition, int width, int rgbColour, int opacity) { - if(yPosition < topY || yPosition >= bottomY) { + /** + * Draws a transparent coloured horizontal line in the drawingArea. + * + * @param xPosition + * The start X-Position of the line. + * @param yPosition + * The Y-Position of the line. + * @param width + * The width of the line. + * @param rgbColour + * The colour of the line. + * @param opacity + * The opacity value ranging from 0 to 256. + */ + public static void drawTransparentHorizontalLine(int xPosition, int yPosition, int width, int rgbColour, + int opacity) { + if (yPosition < topY || yPosition >= bottomY) { return; } - if(xPosition < leftX) { - width -= leftX - xPosition; + if (xPosition < leftX) { + width -= leftX - xPosition; xPosition = leftX; } - if(xPosition + width > bottomX) { + if (xPosition + width > bottomX) { width = bottomX - xPosition; } final int transparency = 256 - opacity; @@ -310,32 +379,40 @@ public static void drawTransparentHorizontalLine(int xPosition, int yPosition, i final int green = (rgbColour >> 8 & 0xff) * opacity; final int blue = (rgbColour & 0xff) * opacity; int pixelIndex = xPosition + yPosition * Rasterizer2D.width; - for(int i = 0; i < width; i++) { + for (int i = 0; i < width; i++) { final int otherRed = (pixels[pixelIndex] >> 16 & 0xff) * transparency; final int otherGreen = (pixels[pixelIndex] >> 8 & 0xff) * transparency; final int otherBlue = (pixels[pixelIndex] & 0xff) * transparency; - final int transparentColour = (red + otherRed >> 8 << 16) + (green + otherGreen >> 8 << 8) + (blue + otherBlue >> 8); + final int transparentColour = (red + otherRed >> 8 << 16) + (green + otherGreen >> 8 << 8) + + (blue + otherBlue >> 8); pixels[pixelIndex++] = transparentColour; } } - /** - * Draws a transparent coloured vertical line in the drawingArea. - * @param xPosition The X-Position of the line. - * @param yPosition The start Y-Position of the line. - * @param height The height of the line. - * @param rgbColour The colour of the line. - * @param opacity The opacity value ranging from 0 to 256. - */ - public static void drawTransparentVerticalLine(int xPosition, int yPosition, int height, int rgbColour, int opacity) { - if(xPosition < leftX || xPosition >= bottomX) { + /** + * Draws a transparent coloured vertical line in the drawingArea. + * + * @param xPosition + * The X-Position of the line. + * @param yPosition + * The start Y-Position of the line. + * @param height + * The height of the line. + * @param rgbColour + * The colour of the line. + * @param opacity + * The opacity value ranging from 0 to 256. + */ + public static void drawTransparentVerticalLine(int xPosition, int yPosition, int height, int rgbColour, + int opacity) { + if (xPosition < leftX || xPosition >= bottomX) { return; } - if(yPosition < topY) { + if (yPosition < topY) { height -= topY - yPosition; yPosition = topY; } - if(yPosition + height > bottomY) { + if (yPosition + height > bottomY) { height = bottomY - yPosition; } final int transparency = 256 - opacity; @@ -343,24 +420,26 @@ public static void drawTransparentVerticalLine(int xPosition, int yPosition, int final int green = (rgbColour >> 8 & 0xff) * opacity; final int blue = (rgbColour & 0xff) * opacity; int pixelIndex = xPosition + yPosition * width; - for(int i = 0; i < height; i++) { + for (int i = 0; i < height; i++) { final int otherRed = (pixels[pixelIndex] >> 16 & 0xff) * transparency; final int otherGreen = (pixels[pixelIndex] >> 8 & 0xff) * transparency; final int otherBlue = (pixels[pixelIndex] & 0xff) * transparency; - final int transparentColour = (red + otherRed >> 8 << 16) + (green + otherGreen >> 8 << 8) + (blue + otherBlue >> 8); + final int transparentColour = (red + otherRed >> 8 << 16) + (green + otherGreen >> 8 << 8) + + (blue + otherBlue >> 8); pixels[pixelIndex] = transparentColour; pixelIndex += width; } } + public static float depthBuffer[]; - public static int pixels[]; - public static int width; - public static int height; - public static int topY; - public static int bottomY; - public static int leftX; - public static int bottomX; - public static int lastX; - public static int viewportCenterX; - public static int viewportCenterY; + public static int pixels[]; + public static int width; + public static int height; + public static int topY; + public static int bottomY; + public static int leftX; + public static int bottomX; + public static int lastX; + public static int viewportCenterX; + public static int viewportCenterY; } \ No newline at end of file diff --git a/Elvarg - Client/src/com/runescape/draw/Rasterizer3D.java b/Elvarg - Client/src/com/runescape/draw/Rasterizer3D.java index 6c2bbaf..5f4d6fe 100644 --- a/Elvarg - Client/src/com/runescape/draw/Rasterizer3D.java +++ b/Elvarg - Client/src/com/runescape/draw/Rasterizer3D.java @@ -24,9 +24,9 @@ public static void clear() { public static void useViewport() { scanOffsets = new int[Rasterizer2D.height]; - + for (int j = 0; j < Rasterizer2D.height; j++) { - scanOffsets[j] = Rasterizer2D.width * j; + scanOffsets[j] = Rasterizer2D.width * j; } originViewX = Rasterizer2D.width / 2; @@ -45,12 +45,12 @@ public static void reposition(int width, int length) { public static void clearTextureCache() { textureRequestPixelBuffer = null; for (int i = 0; i < 50; i++) - texturesPixelBuffer[i] = null; + texturesPixelBuffer[i] = null; } public static void initiateRequestBuffers() { if (textureRequestPixelBuffer == null) { - textureRequestBufferPointer = 20; + textureRequestBufferPointer = 20; if (lowMem) textureRequestPixelBuffer = new int[textureRequestBufferPointer][16384]; else @@ -60,10 +60,10 @@ public static void initiateRequestBuffers() { } } - public static void loadTextures(FileArchive archive) { + public static void loadTextures(FileArchive archive) { textureCount = 0; - for (int index = 0; index < 51; index++) { - try { + for (int index = 0; index < 51; index++) { + try { textures[index] = new IndexedImage(archive, String.valueOf(index), 0); if (lowMem && textures[index].resizeWidth == 128) { textures[index].downscale(); @@ -90,7 +90,8 @@ public static int getOverallColour(int textureId) { totalBlue += currentPalette[textureId][ptr] & 0xff; } - int avgPaletteColour = (totalRed / colourCount << 16) + (totalGreen / colourCount << 8) + totalBlue / colourCount; + int avgPaletteColour = (totalRed / colourCount << 16) + (totalGreen / colourCount << 8) + + totalBlue / colourCount; avgPaletteColour = adjustBrightness(avgPaletteColour, 1.3999999999999999D); if (avgPaletteColour == 0) avgPaletteColour = 1; @@ -99,15 +100,15 @@ public static int getOverallColour(int textureId) { } public static void requestTextureUpdate(int textureId) { - if (texturesPixelBuffer[textureId] == null) { - return; - } - textureRequestPixelBuffer[textureRequestBufferPointer++] = texturesPixelBuffer[textureId]; - texturesPixelBuffer[textureId] = null; + if (texturesPixelBuffer[textureId] == null) { + return; + } + textureRequestPixelBuffer[textureRequestBufferPointer++] = texturesPixelBuffer[textureId]; + texturesPixelBuffer[textureId] = null; } private static int[] getTexturePixels(int textureId) { - textureLastUsed[textureId] = lastTextureRetrievalCount++; + textureLastUsed[textureId] = lastTextureRetrievalCount++; if (texturesPixelBuffer[textureId] != null) return texturesPixelBuffer[textureId]; int texturePixels[]; @@ -130,7 +131,7 @@ private static int[] getTexturePixels(int textureId) { IndexedImage background = textures[textureId]; int texturePalette[] = currentPalette[textureId]; if (lowMem) { - textureIsTransparant[textureId] = false; + textureIsTransparant[textureId] = false; for (int i1 = 0; i1 < 4096; i1++) { int colour = texturePixels[i1] = texturePalette[background.palettePixels[i1]] & 0xf8f8ff; if (colour == 0) @@ -144,7 +145,8 @@ private static int[] getTexturePixels(int textureId) { if (background.width == 64) { for (int x = 0; x < 128; x++) { for (int y = 0; y < 128; y++) - texturePixels[y + (x << 7)] = texturePalette[background.palettePixels[(y >> 1) + ((x >> 1) << 6)]]; + texturePixels[y + + (x << 7)] = texturePalette[background.palettePixels[(y >> 1) + ((x >> 1) << 6)]]; } } else { for (int i = 0; i < 16384; i++) @@ -168,10 +170,10 @@ private static int[] getTexturePixels(int textureId) { public static void setBrightness(double brightness) { int j = 0; for (int k = 0; k < 512; k++) { - double d1 = (double) (k / 8) / 64D + 0.0078125D; - double d2 = (double) (k & 7) / 8D + 0.0625D; + double d1 = k / 8 / 64D + 0.0078125D; + double d2 = (k & 7) / 8D + 0.0625D; for (int k1 = 0; k1 < 128; k1++) { - double d3 = (double) k1 / 128D; + double d3 = k1 / 128D; double r = d3; double g = d3; double b = d3; @@ -221,7 +223,7 @@ else if (3D * d11 < 2D) rgb = adjustBrightness(rgb, brightness); if (rgb == 0) rgb = 1; - hslToRgb[j++] = rgb; + hslToRgb[j++] = rgb; } } @@ -244,9 +246,9 @@ else if (3D * d11 < 2D) } private static int adjustBrightness(int rgb, double intensity) { - double r = (double) (rgb >> 16) / 256D; - double g = (double) (rgb >> 8 & 0xff) / 256D; - double b = (double) (rgb & 0xff) / 256D; + double r = (rgb >> 16) / 256D; + double g = (rgb >> 8 & 0xff) / 256D; + double b = (rgb & 0xff) / 256D; r = Math.pow(r, intensity); g = Math.pow(g, intensity); b = Math.pow(b, intensity); @@ -256,7 +258,8 @@ private static int adjustBrightness(int rgb, double intensity) { return (r_byte << 16) + (g_byte << 8) + b_byte; } - public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_b, int x_c, int hsl1, int hsl2, int hsl3, float z_a, float z_b, float z_c) { + public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_b, int x_c, int hsl1, int hsl2, + int hsl3, float z_a, float z_b, float z_c) { if (z_a < 0 || z_b < 0 || z_c < 0) return; int rgb1 = hslToRgb[hsl1]; @@ -475,7 +478,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ y_b -= y_c; y_c -= y_a; for (y_a = scanOffsets[y_a]; --y_c >= 0; y_a += Rasterizer2D.width) { - drawShadedScanline(Rasterizer2D.pixels, y_a, x_a >> 16, x_b >> 16, r1, g1, b1, r2, g2, b2, z_a, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_a, x_a >> 16, x_b >> 16, r1, g1, b1, r2, g2, b2, z_a, + depth_slope); x_b += c_to_a; x_a += a_to_b; r2 += dr3; @@ -487,7 +491,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ z_a += depth_increment; } while (--y_b >= 0) { - drawShadedScanline(Rasterizer2D.pixels, y_a, x_a >> 16, x_c >> 16, r1, g1, b1, r3, g3, b3, z_a, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_a, x_a >> 16, x_c >> 16, r1, g1, b1, r3, g3, b3, z_a, + depth_slope); x_c += b_to_c; x_a += a_to_b; r3 += dr2; @@ -665,7 +670,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ y_c -= y_a; y_a -= y_b; for (y_b = scanOffsets[y_b]; --y_a >= 0; y_b += Rasterizer2D.width) { - drawShadedScanline(Rasterizer2D.pixels, y_b, x_b >> 16, x_c >> 16, r2, g2, b2, r3, g3, b3, z_b, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_b, x_b >> 16, x_c >> 16, r2, g2, b2, r3, g3, b3, z_b, + depth_slope); x_c += a_to_b; x_b += b_to_c; r3 += dr1; @@ -677,7 +683,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ z_b += depth_increment; } while (--y_c >= 0) { - drawShadedScanline(Rasterizer2D.pixels, y_b, x_b >> 16, x_a >> 16, r2, g2, b2, r1, g1, b1, z_b, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_b, x_b >> 16, x_a >> 16, r2, g2, b2, r1, g1, b1, z_b, + depth_slope); x_a += c_to_a; x_b += b_to_c; r1 += dr3; @@ -764,7 +771,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ y_b -= y_a; y_a -= y_c; for (y_c = scanOffsets[y_c]; --y_a >= 0; y_c += Rasterizer2D.width) { - drawShadedScanline(Rasterizer2D.pixels, y_c, x_c >> 16, x_b >> 16, r3, g3, b3, r2, g2, b2, z_c, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_c, x_c >> 16, x_b >> 16, r3, g3, b3, r2, g2, b2, z_c, + depth_slope); x_b += b_to_c; x_c += c_to_a; r2 += dr2; @@ -776,7 +784,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ z_c += depth_increment; } while (--y_b >= 0) { - drawShadedScanline(Rasterizer2D.pixels, y_c, x_a >> 16, x_b >> 16, r1, g1, b1, r2, g2, b2, z_c, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_c, x_a >> 16, x_b >> 16, r1, g1, b1, r2, g2, b2, z_c, + depth_slope); x_b += b_to_c; x_a += a_to_b; r2 += dr2; @@ -821,7 +830,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ y_a -= y_b; y_b -= y_c; for (y_c = scanOffsets[y_c]; --y_b >= 0; y_c += Rasterizer2D.width) { - drawShadedScanline(Rasterizer2D.pixels, y_c, x_a >> 16, x_c >> 16, r1, g1, b1, r3, g3, b3, z_c, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_c, x_a >> 16, x_c >> 16, r1, g1, b1, r3, g3, b3, z_c, + depth_slope); x_a += b_to_c; x_c += c_to_a; r1 += dr2; @@ -833,7 +843,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ z_c += depth_increment; } while (--y_a >= 0) { - drawShadedScanline(Rasterizer2D.pixels, y_c, x_b >> 16, x_c >> 16, r2, g2, b2, r3, g3, b3, z_c, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_c, x_b >> 16, x_c >> 16, r2, g2, b2, r3, g3, b3, z_c, + depth_slope); x_b += a_to_b; x_c += c_to_a; r2 += dr1; @@ -850,7 +861,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ y_a -= y_b; y_b -= y_c; for (y_c = scanOffsets[y_c]; --y_b >= 0; y_c += Rasterizer2D.width) { - drawShadedScanline(Rasterizer2D.pixels, y_c, x_c >> 16, x_a >> 16, r3, g3, b3, r1, g1, b1, z_c, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_c, x_c >> 16, x_a >> 16, r3, g3, b3, r1, g1, b1, z_c, + depth_slope); x_a += b_to_c; x_c += c_to_a; r1 += dr2; @@ -862,7 +874,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ z_c += depth_increment; } while (--y_a >= 0) { - drawShadedScanline(Rasterizer2D.pixels, y_c, x_c >> 16, x_b >> 16, r3, g3, b3, r2, g2, b2, z_c, depth_slope); + drawShadedScanline(Rasterizer2D.pixels, y_c, x_c >> 16, x_b >> 16, r3, g3, b3, r2, g2, b2, z_c, + depth_slope); x_b += a_to_b; x_c += c_to_a; r2 += dr1; @@ -876,7 +889,8 @@ public static void drawShadedTriangle(int y_a, int y_b, int y_c, int x_a, int x_ } } - public static void drawShadedScanline(int[] dest, int offset, int x1, int x2, int r1, int g1, int b1, int r2, int g2, int b2, float depth, float depth_slope) { + public static void drawShadedScanline(int[] dest, int offset, int x1, int x2, int r1, int g1, int b1, int r2, + int g2, int b2, float depth, float depth_slope) { int n = x2 - x1; if (n <= 0) { return; @@ -899,7 +913,7 @@ public static void drawShadedScanline(int[] dest, int offset, int x1, int x2, in } if (x1 < x2) { offset += x1; - depth += depth_slope * (float) x1; + depth += depth_slope * x1; if (alpha == 0) { while (--n >= 0) { if (true) { @@ -1297,7 +1311,7 @@ private static void drawFlatTexturedScanline(int dest[], int dest_off, int loops return; dest_off += start_x; rgb = end_x - start_x >> 2; - depth += depth_slope * (float) start_x; + depth += depth_slope * start_x; if (alpha == 0) { while (--rgb >= 0) { for (int i = 0; i < 4; i++) { @@ -1429,8 +1443,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_b -= y_a; y_a = scanOffsets[y_a]; while (--y_b >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, Oa, - Ob, Oc, Ha, Hb, Hc, z_a, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, + Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope); x_c += c_to_a; x_a += a_to_b; z_a += depth_increment; @@ -1442,8 +1456,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_c >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, Oa, - Ob, Oc, Ha, Hb, Hc, z_a, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, + Oa, Ob, Oc, Ha, Hb, Hc, z_a, depth_slope); x_c += c_to_a; x_b += b_to_c; z_a += depth_increment; @@ -1460,8 +1474,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_b -= y_a; y_a = scanOffsets[y_a]; while (--y_b >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_a >> 16, x_c >> 16, k1 >> 8, i2 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_a, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_a >> 16, x_c >> 16, k1 >> 8, i2 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_a, depth_slope); x_c += c_to_a; x_a += a_to_b; z_a += depth_increment; @@ -1473,8 +1487,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_c >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_b >> 16, x_c >> 16, l1 >> 8, i2 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_a, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_b >> 16, x_c >> 16, l1 >> 8, i2 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_a, depth_slope); x_c += c_to_a; x_b += b_to_c; z_a += depth_increment; @@ -1513,8 +1527,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_c -= y_a; y_a = scanOffsets[y_a]; while (--y_c >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_b >> 16, x_a >> 16, l1 >> 8, k1 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_a, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_b >> 16, x_a >> 16, l1 >> 8, k1 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_a, depth_slope); x_b += c_to_a; x_a += a_to_b; l1 += grad_c_off; @@ -1526,8 +1540,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_b >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_a, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_a, depth_slope); x_c += b_to_c; x_a += a_to_b; i2 += grad_b_off; @@ -1544,8 +1558,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_c -= y_a; y_a = scanOffsets[y_a]; while (--y_c >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_a >> 16, x_b >> 16, k1 >> 8, l1 >> 8, Oa, Ob, Oc, - Ha, Hb, Hc, z_a, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_a >> 16, x_b >> 16, k1 >> 8, l1 >> 8, Oa, Ob, + Oc, Ha, Hb, Hc, z_a, depth_slope); x_b += c_to_a; x_a += a_to_b; l1 += grad_c_off; @@ -1557,8 +1571,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_b >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_a >> 16, x_c >> 16, k1 >> 8, i2 >> 8, Oa, Ob, Oc, - Ha, Hb, Hc, z_a, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_a, x_a >> 16, x_c >> 16, k1 >> 8, i2 >> 8, Oa, Ob, + Oc, Ha, Hb, Hc, z_a, depth_slope); x_c += b_to_c; x_a += a_to_b; i2 += grad_b_off; @@ -1606,8 +1620,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_c -= y_b; y_b = scanOffsets[y_b]; while (--y_c >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_a >> 16, x_b >> 16, k1 >> 8, l1 >> 8, Oa, - Ob, Oc, Ha, Hb, Hc, z_b, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_a >> 16, x_b >> 16, k1 >> 8, l1 >> 8, + Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope); x_a += a_to_b; x_b += b_to_c; k1 += grad_a_off; @@ -1619,8 +1633,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_a >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_a >> 16, x_c >> 16, k1 >> 8, i2 >> 8, Oa, - Ob, Oc, Ha, Hb, Hc, z_b, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_a >> 16, x_c >> 16, k1 >> 8, i2 >> 8, + Oa, Ob, Oc, Ha, Hb, Hc, z_b, depth_slope); x_a += a_to_b; x_c += c_to_a; k1 += grad_a_off; @@ -1637,8 +1651,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_c -= y_b; y_b = scanOffsets[y_b]; while (--y_c >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_b >> 16, x_a >> 16, l1 >> 8, k1 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_b, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_b >> 16, x_a >> 16, l1 >> 8, k1 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_b, depth_slope); x_a += a_to_b; x_b += b_to_c; k1 += grad_a_off; @@ -1650,8 +1664,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_a >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_b, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_b, depth_slope); x_a += a_to_b; x_c += c_to_a; k1 += grad_a_off; @@ -1690,8 +1704,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_a -= y_b; y_b = scanOffsets[y_b]; while (--y_a >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_b, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_b, depth_slope); x_c += a_to_b; x_b += b_to_c; i2 += grad_a_off; @@ -1703,8 +1717,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_c >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_a >> 16, x_b >> 16, k1 >> 8, l1 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_b, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_a >> 16, x_b >> 16, k1 >> 8, l1 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_b, depth_slope); x_a += c_to_a; x_b += b_to_c; k1 += grad_c_off; @@ -1721,8 +1735,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_a -= y_b; y_b = scanOffsets[y_b]; while (--y_a >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_b >> 16, x_c >> 16, l1 >> 8, i2 >> 8, Oa, Ob, Oc, - Ha, Hb, Hc, z_b, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_b >> 16, x_c >> 16, l1 >> 8, i2 >> 8, Oa, Ob, + Oc, Ha, Hb, Hc, z_b, depth_slope); x_c += a_to_b; x_b += b_to_c; i2 += grad_a_off; @@ -1734,8 +1748,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_c >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_b >> 16, x_a >> 16, l1 >> 8, k1 >> 8, Oa, Ob, Oc, - Ha, Hb, Hc, z_b, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_b, x_b >> 16, x_a >> 16, l1 >> 8, k1 >> 8, Oa, Ob, + Oc, Ha, Hb, Hc, z_b, depth_slope); x_a += c_to_a; x_b += b_to_c; k1 += grad_c_off; @@ -1782,8 +1796,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_a -= y_c; y_c = scanOffsets[y_c]; while (--y_a >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_b >> 16, x_c >> 16, l1 >> 8, i2 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_c, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_b >> 16, x_c >> 16, l1 >> 8, i2 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_c, depth_slope); x_b += b_to_c; x_c += c_to_a; l1 += grad_b_off; @@ -1795,8 +1809,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_b >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_b >> 16, x_a >> 16, l1 >> 8, k1 >> 8, Oa, Ob, - Oc, Ha, Hb, Hc, z_c, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_b >> 16, x_a >> 16, l1 >> 8, k1 >> 8, Oa, + Ob, Oc, Ha, Hb, Hc, z_c, depth_slope); x_b += b_to_c; x_a += a_to_b; l1 += grad_b_off; @@ -1813,8 +1827,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_a -= y_c; y_c = scanOffsets[y_c]; while (--y_a >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, Oa, Ob, Oc, - Ha, Hb, Hc, z_c, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, Oa, Ob, + Oc, Ha, Hb, Hc, z_c, depth_slope); x_b += b_to_c; x_c += c_to_a; l1 += grad_b_off; @@ -1826,8 +1840,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_b >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_a >> 16, x_b >> 16, k1 >> 8, l1 >> 8, Oa, Ob, Oc, - Ha, Hb, Hc, z_c, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_a >> 16, x_b >> 16, k1 >> 8, l1 >> 8, Oa, Ob, + Oc, Ha, Hb, Hc, z_c, depth_slope); x_b += b_to_c; x_a += a_to_b; l1 += grad_b_off; @@ -1866,8 +1880,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_b -= y_c; y_c = scanOffsets[y_c]; while (--y_b >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_a >> 16, x_c >> 16, k1 >> 8, i2 >> 8, Oa, Ob, Oc, - Ha, Hb, Hc, z_c, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_a >> 16, x_c >> 16, k1 >> 8, i2 >> 8, Oa, Ob, + Oc, Ha, Hb, Hc, z_c, depth_slope); x_a += b_to_c; x_c += c_to_a; k1 += grad_b_off; @@ -1879,8 +1893,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_a >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_b >> 16, x_c >> 16, l1 >> 8, i2 >> 8, Oa, Ob, Oc, - Ha, Hb, Hc, z_c, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_b >> 16, x_c >> 16, l1 >> 8, i2 >> 8, Oa, Ob, + Oc, Ha, Hb, Hc, z_c, depth_slope); x_b += a_to_b; x_c += c_to_a; l1 += grad_a_off; @@ -1897,8 +1911,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int y_b -= y_c; y_c = scanOffsets[y_c]; while (--y_b >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, Oa, Ob, Oc, Ha, - Hb, Hc, z_c, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_c >> 16, x_a >> 16, i2 >> 8, k1 >> 8, Oa, Ob, Oc, + Ha, Hb, Hc, z_c, depth_slope); x_a += b_to_c; x_c += c_to_a; k1 += grad_b_off; @@ -1910,8 +1924,8 @@ public static void drawTexturedTriangle(int y_a, int y_b, int y_c, int x_a, int Oc += Vc; } while (--y_a >= 0) { - drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, Oa, Ob, Oc, Ha, - Hb, Hc, z_c, depth_slope); + drawTexturedScanline(Rasterizer2D.pixels, texture, y_c, x_c >> 16, x_b >> 16, i2 >> 8, l1 >> 8, Oa, Ob, Oc, + Ha, Hb, Hc, z_c, depth_slope); x_b += a_to_b; x_c += c_to_a; l1 += grad_a_off; @@ -1957,7 +1971,7 @@ public static void drawTexturedScanline(int dest[], int texture[], int dest_off, shadeValue <<= 9; } dest_off += start_x; - depth += depth_slope * (float) start_x; + depth += depth_slope * start_x; if (lowMem) { int i4 = 0; int k4 = 0; @@ -2572,7 +2586,7 @@ private static void drawDepthTriangleScanline(int dest_off, int start_x, int end } dest_off += start_x - 1; int loops = end_x - start_x >> 2; - depth += depth_slope * (float) start_x; + depth += depth_slope * start_x; if (alpha == 0) { while (--loops >= 0) { dest_off++; @@ -2642,7 +2656,7 @@ private static void drawDepthTriangleScanline(int dest_off, int start_x, int end public static boolean aBoolean1464 = true; public static int alpha; public static int originViewX; - public static int originViewY; + public static int originViewY; private static int[] anIntArray1468; public static final int[] anIntArray1469; public static int anIntArray1470[]; @@ -2672,8 +2686,8 @@ private static void drawDepthTriangleScanline(int dest_off, int start_x, int end anIntArray1469[j] = 0x10000 / j; } for (int k = 0; k < 2048; k++) { - anIntArray1470[k] = (int) (65536D * Math.sin((double) k * 0.0030679614999999999D)); - COSINE[k] = (int) (65536D * Math.cos((double) k * 0.0030679614999999999D)); + anIntArray1470[k] = (int) (65536D * Math.sin(k * 0.0030679614999999999D)); + COSINE[k] = (int) (65536D * Math.cos(k * 0.0030679614999999999D)); } } } \ No newline at end of file diff --git a/Elvarg - Client/src/com/runescape/entity/GameObject.java b/Elvarg - Client/src/com/runescape/entity/GameObject.java index db695ca..ae6689d 100644 --- a/Elvarg - Client/src/com/runescape/entity/GameObject.java +++ b/Elvarg - Client/src/com/runescape/entity/GameObject.java @@ -18,8 +18,8 @@ public final class GameObject { public int anInt527; public int anInt528; public int uid; - /** - * mask = (byte)((objectRotation << 6) + objectType); - */ + /** + * mask = (byte)((objectRotation << 6) + objectType); + */ public byte mask; } diff --git a/Elvarg - Client/src/com/runescape/entity/Item.java b/Elvarg - Client/src/com/runescape/entity/Item.java index 22cf13d..f2ed13a 100644 --- a/Elvarg - Client/src/com/runescape/entity/Item.java +++ b/Elvarg - Client/src/com/runescape/entity/Item.java @@ -5,6 +5,7 @@ public final class Item extends Renderable { + @Override public final Model getRotatedModel() { ItemDefinition itemDef = ItemDefinition.lookup(ID); return itemDef.getModel(itemCount); diff --git a/Elvarg - Client/src/com/runescape/entity/Mob.java b/Elvarg - Client/src/com/runescape/entity/Mob.java index ae97155..1a579c3 100644 --- a/Elvarg - Client/src/com/runescape/entity/Mob.java +++ b/Elvarg - Client/src/com/runescape/entity/Mob.java @@ -25,7 +25,7 @@ public class Mob extends Renderable { public int movementAnimation; public int displayedMovementFrames; public int anInt1519; - public int graphic; + public int graphic; public int currentAnimation; public int anInt1522; public int graphicDelay; @@ -41,10 +41,10 @@ public class Mob extends Renderable { public int currentHealth; public int maxHealth; public int textCycle; - public int time; + public int time; public int faceX; public int faceY; - public int size; + public int size; public boolean animationStretches; public int anInt1542; public int initialX; @@ -67,7 +67,7 @@ public class Mob extends Renderable { public int nextGraphicsAnimationFrame; public int nextIdleAnimationFrame; public int nextSpotAnimFrame; - + public Mob() { pathX = new int[10]; pathY = new int[10]; @@ -97,7 +97,7 @@ public Mob() { public final void setPos(int x, int y, boolean flag) { if (emoteAnimation != -1 && Animation.animations[emoteAnimation].priority == 1) emoteAnimation = -1; - + if (!flag) { int dx = x - pathX[0]; int dy = y - pathY[0]; @@ -141,16 +141,16 @@ public final void updateHitData(int hitType, int hitDamage, int currentTime) { } public void nextPreForcedStep() { - int remaining = startForceMovement - Client.tick; - int tempX = initialX * 128 + size * 64; - int tempY = initialY * 128 + size * 64; + int remaining = startForceMovement - Client.tick; + int tempX = initialX * 128 + size * 64; + int tempY = initialY * 128 + size * 64; x += (tempX - x) / remaining; y += (tempY - y) / remaining; anInt1503 = 0; if (direction == 0) { - nextStepOrientation = 1024; + nextStepOrientation = 1024; } if (direction == 1) { @@ -167,17 +167,14 @@ public void nextPreForcedStep() { } public void nextForcedMovementStep() { - if (endForceMovement == Client.tick || emoteAnimation == -1 - || animationDelay != 0 - || emoteTimeRemaining - + 1 > Animation.animations[emoteAnimation] - .duration(displayedEmoteFrames)) { - int remaining = endForceMovement - startForceMovement; - int elapsed = Client.tick - startForceMovement; - int initialX = this.initialX * 128 + size * 64; + if (endForceMovement == Client.tick || emoteAnimation == -1 || animationDelay != 0 + || emoteTimeRemaining + 1 > Animation.animations[emoteAnimation].duration(displayedEmoteFrames)) { + int remaining = endForceMovement - startForceMovement; + int elapsed = Client.tick - startForceMovement; + int initialX = this.initialX * 128 + size * 64; int initialY = this.initialY * 128 + size * 64; - int endX = destinationX * 128 + size * 64; - int endY = destinationY * 128 + size * 64; + int endX = destinationX * 128 + size * 64; + int endY = destinationY * 128 + size * 64; x = (initialX * (remaining - elapsed) + endX * elapsed) / remaining; y = (initialY * (remaining - elapsed) + endY * elapsed) / remaining; } @@ -199,18 +196,18 @@ public void nextForcedMovementStep() { nextStepOrientation = 512; } - orientation = nextStepOrientation; + orientation = nextStepOrientation; } public void nextStep() { - movementAnimation = idleAnimation; + movementAnimation = idleAnimation; - if (remainingPath == 0) { + if (remainingPath == 0) { anInt1503 = 0; return; } - - if(emoteAnimation > Animation.animations.length) { + + if (emoteAnimation > Animation.animations.length) { emoteAnimation = -1; return; } @@ -226,8 +223,8 @@ public void nextStep() { return; } } - int tempX = x; - int tempY = y; + int tempX = x; + int tempY = y; int nextX = pathX[remainingPath - 1] * 128 + size * 64; int nextY = pathY[remainingPath - 1] * 128 + size * 64; if (nextX - tempX > 256 || nextX - tempX < -256 || nextY - tempY > 256 || nextY - tempY < -256) { @@ -281,8 +278,7 @@ public void nextStep() { int positionDelta = 4; - if (orientation != nextStepOrientation && interactingEntity == -1 - && degreesToTurn != 0) { + if (orientation != nextStepOrientation && interactingEntity == -1 && degreesToTurn != 0) { positionDelta = 2; } @@ -303,8 +299,7 @@ public void nextStep() { positionDelta <<= 1; } - if (positionDelta >= 8 && movementAnimation == walkAnimIndex - && runAnimIndex != -1) { + if (positionDelta >= 8 && movementAnimation == walkAnimIndex && runAnimIndex != -1) { movementAnimation = runAnimIndex; } @@ -384,81 +379,84 @@ public final void moveInDir(boolean run, int direction) { public void updateAnimation() { try { - if (movementAnimation > 13798) { - movementAnimation = -1; + if (movementAnimation > 13798) { + movementAnimation = -1; + } + animationStretches = false; + if (movementAnimation != -1) { + Animation animation = Animation.animations[movementAnimation]; + anInt1519++; + if (displayedMovementFrames < animation.frameCount + && anInt1519 > animation.duration(displayedMovementFrames)) { + anInt1519 = 1; + displayedMovementFrames++; + nextIdleAnimationFrame++; } - animationStretches = false; - if (movementAnimation != -1) { - Animation animation = Animation.animations[movementAnimation]; - anInt1519++; - if (displayedMovementFrames < animation.frameCount && anInt1519 > animation.duration(displayedMovementFrames)) { - anInt1519 = 1; - displayedMovementFrames++; - nextIdleAnimationFrame++; - } - nextIdleAnimationFrame = displayedMovementFrames + 1; + nextIdleAnimationFrame = displayedMovementFrames + 1; + if (nextIdleAnimationFrame >= animation.frameCount) { if (nextIdleAnimationFrame >= animation.frameCount) { - if (nextIdleAnimationFrame >= animation.frameCount) { - nextIdleAnimationFrame = 0; - } - } - if (displayedMovementFrames >= animation.frameCount) { - anInt1519 = 1; - displayedMovementFrames = 0; + nextIdleAnimationFrame = 0; } } - if (graphic != -1 && Client.tick >= graphicDelay) { - if (currentAnimation < 0) - currentAnimation = 0; - Animation animation_1 = Graphic.cache[graphic].animationSequence; - - for (anInt1522++; currentAnimation < animation_1.frameCount && anInt1522 > animation_1.duration(currentAnimation); currentAnimation++) - anInt1522 -= animation_1.duration(currentAnimation); - - - if (currentAnimation >= animation_1.frameCount && (currentAnimation < 0 || currentAnimation >= animation_1.frameCount)) { - graphic = -1; - } - if (Configuration.enableTweening) { - nextIdleAnimationFrame = displayedMovementFrames + 1; - } - if (nextSpotAnimFrame >= animation_1.frameCount) { - nextSpotAnimFrame = -1; - } + if (displayedMovementFrames >= animation.frameCount) { + anInt1519 = 1; + displayedMovementFrames = 0; } - if (emoteAnimation != -1 && animationDelay <= 1) { - Animation animation_2 = Animation.animations[emoteAnimation]; - if (animation_2.animatingPrecedence == 1 && anInt1542 > 0 && startForceMovement <= Client.tick && endForceMovement < Client.tick) { - animationDelay = 1; - return; - } + } + if (graphic != -1 && Client.tick >= graphicDelay) { + if (currentAnimation < 0) + currentAnimation = 0; + Animation animation_1 = Graphic.cache[graphic].animationSequence; + + for (anInt1522++; currentAnimation < animation_1.frameCount + && anInt1522 > animation_1.duration(currentAnimation); currentAnimation++) + anInt1522 -= animation_1.duration(currentAnimation); + + if (currentAnimation >= animation_1.frameCount + && (currentAnimation < 0 || currentAnimation >= animation_1.frameCount)) { + graphic = -1; } - if (emoteAnimation != -1 && animationDelay == 0) { - Animation animation_3 = Animation.animations[emoteAnimation]; - for (emoteTimeRemaining++; displayedEmoteFrames < animation_3.frameCount && emoteTimeRemaining > animation_3.duration(displayedEmoteFrames); displayedEmoteFrames++) - emoteTimeRemaining -= animation_3.duration(displayedEmoteFrames); - - if (displayedEmoteFrames >= animation_3.frameCount) { - displayedEmoteFrames -= animation_3.loopOffset; - currentAnimationLoops++; - if (currentAnimationLoops >= animation_3.maximumLoops) - emoteAnimation = -1; - if (displayedEmoteFrames < 0 || displayedEmoteFrames >= animation_3.frameCount) - emoteAnimation = -1; - } - if (Configuration.enableTweening) { - nextAnimationFrame = displayedEmoteFrames + 1; - } - if (nextAnimationFrame >= animation_3.frameCount) { - nextAnimationFrame = -1; - } - animationStretches = animation_3.stretches; + if (Configuration.enableTweening) { + nextIdleAnimationFrame = displayedMovementFrames + 1; + } + if (nextSpotAnimFrame >= animation_1.frameCount) { + nextSpotAnimFrame = -1; + } + } + if (emoteAnimation != -1 && animationDelay <= 1) { + Animation animation_2 = Animation.animations[emoteAnimation]; + if (animation_2.animatingPrecedence == 1 && anInt1542 > 0 && startForceMovement <= Client.tick + && endForceMovement < Client.tick) { + animationDelay = 1; + return; + } + } + if (emoteAnimation != -1 && animationDelay == 0) { + Animation animation_3 = Animation.animations[emoteAnimation]; + for (emoteTimeRemaining++; displayedEmoteFrames < animation_3.frameCount + && emoteTimeRemaining > animation_3.duration(displayedEmoteFrames); displayedEmoteFrames++) + emoteTimeRemaining -= animation_3.duration(displayedEmoteFrames); + + if (displayedEmoteFrames >= animation_3.frameCount) { + displayedEmoteFrames -= animation_3.loopOffset; + currentAnimationLoops++; + if (currentAnimationLoops >= animation_3.maximumLoops) + emoteAnimation = -1; + if (displayedEmoteFrames < 0 || displayedEmoteFrames >= animation_3.frameCount) + emoteAnimation = -1; } - if (animationDelay > 0) - animationDelay--; + if (Configuration.enableTweening) { + nextAnimationFrame = displayedEmoteFrames + 1; + } + if (nextAnimationFrame >= animation_3.frameCount) { + nextAnimationFrame = -1; + } + animationStretches = animation_3.stretches; + } + if (animationDelay > 0) + animationDelay--; - - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/Elvarg - Client/src/com/runescape/entity/Npc.java b/Elvarg - Client/src/com/runescape/entity/Npc.java index c1bd170..26ea2ff 100644 --- a/Elvarg - Client/src/com/runescape/entity/Npc.java +++ b/Elvarg - Client/src/com/runescape/entity/Npc.java @@ -16,8 +16,7 @@ private Model getAnimatedModel() { int movement = -1; if (super.movementAnimation >= 0 && super.movementAnimation != super.idleAnimation) movement = Animation.animations[super.movementAnimation].primaryFrames[super.displayedMovementFrames]; - return desc.getAnimatedModel(movement, emote, - Animation.animations[super.emoteAnimation].interleaveOrder); + return desc.getAnimatedModel(movement, emote, Animation.animations[super.emoteAnimation].interleaveOrder); } int movement = -1; if (super.movementAnimation >= 0) @@ -25,6 +24,7 @@ private Model getAnimatedModel() { return desc.getAnimatedModel(-1, movement, null); } + @Override public Model getRotatedModel() { if (desc == null) return null; @@ -37,18 +37,15 @@ public Model getRotatedModel() { Model graphicModel = spotAnim.getModel(); if (graphicModel != null) { int frame = spotAnim.animationSequence.primaryFrames[super.currentAnimation]; - Model model = new Model(true, Frame.noAnimationInProgress(frame), - false, graphicModel); + Model model = new Model(true, Frame.noAnimationInProgress(frame), false, graphicModel); model.translate(0, -super.graphicHeight, 0); model.skin(); model.applyTransform(frame); model.faceGroups = null; model.vertexGroups = null; if (spotAnim.resizeXY != 128 || spotAnim.resizeZ != 128) - model.scale(spotAnim.resizeXY, spotAnim.resizeXY, - spotAnim.resizeZ); - model.light(64 + spotAnim.modelBrightness, - 850 + spotAnim.modelShadow, -30, -50, -30, true); + model.scale(spotAnim.resizeXY, spotAnim.resizeXY, spotAnim.resizeZ); + model.light(64 + spotAnim.modelBrightness, 850 + spotAnim.modelShadow, -30, -50, -30, true); Model models[] = { animatedModel, model }; animatedModel = new Model(models); } @@ -58,6 +55,7 @@ public Model getRotatedModel() { return animatedModel; } + @Override public boolean isVisible() { return desc != null; } diff --git a/Elvarg - Client/src/com/runescape/entity/Player.java b/Elvarg - Client/src/com/runescape/entity/Player.java index 0f2b027..82b1f00 100644 --- a/Elvarg - Client/src/com/runescape/entity/Player.java +++ b/Elvarg - Client/src/com/runescape/entity/Player.java @@ -15,8 +15,8 @@ public final class Player extends Mob { - private long cachedModel = -1L; - public NpcDefinition npcDefinition; + private long cachedModel = -1L; + public NpcDefinition npcDefinition; public boolean aBoolean1699; public final int[] appearanceColors = new int[5]; public int team; @@ -36,7 +36,7 @@ public final class Player extends Mob { public int objectYPos; public Model playerModel; public final int[] equipment = new int[12]; - private long appearanceOffset ; + private long appearanceOffset; public int objectAnInt1719LesserXLoc; public int objectAnInt1720LesserYLoc; public int objectAnInt1721GreaterXLoc; @@ -45,13 +45,14 @@ public final class Player extends Mob { public String clanName = "None"; public int rights; + @Override public Model getRotatedModel() { if (!visible) { return null; } - Model animatedModel = getAnimatedModel(); + Model animatedModel = getAnimatedModel(); if (animatedModel == null) { return null; @@ -67,8 +68,8 @@ public Model getRotatedModel() { if (super.graphic != -1 && super.currentAnimation != -1) { Graphic spotAnim = Graphic.cache[super.graphic]; - Model spotAnimationModel = spotAnim.getModel(); - + Model spotAnimationModel = spotAnim.getModel(); + /** * MAKE SURE WE'VE LOADED THE GRAPHIC BEFORE ATTEMPTING TO DO IT. * Fixes graphics flickering. @@ -77,28 +78,32 @@ public Model getRotatedModel() { spotAnimationModel = null; } - if (spotAnimationModel != null) { + if (spotAnimationModel != null) { - Model model_3 = new Model(true, Frame.noAnimationInProgress(super.currentAnimation), false, spotAnimationModel ); + Model model_3 = new Model(true, Frame.noAnimationInProgress(super.currentAnimation), false, + spotAnimationModel); int nextFrame = spotAnim.animationSequence.primaryFrames[super.nextGraphicsAnimationFrame]; int cycle1 = spotAnim.animationSequence.durations[super.currentAnimation]; int cycle2 = super.anInt1522; model_3.translate(0, -super.graphicHeight, 0); model_3.skin(); - /*model_3.applyAnimationFrame(spotAnim.animationSequence.primaryFrames[super.currentAnimation], nextFrame, - cycle1, cycle2);*/ + /* + * model_3.applyAnimationFrame(spotAnim.animationSequence. + * primaryFrames[super.currentAnimation], nextFrame, cycle1, + * cycle2); + */ model_3.applyTransform(spotAnim.animationSequence.primaryFrames[super.currentAnimation]); model_3.faceGroups = null; model_3.vertexGroups = null; if (spotAnim.resizeXY != 128 || spotAnim.resizeZ != 128) model_3.scale(spotAnim.resizeXY, spotAnim.resizeXY, spotAnim.resizeZ); model_3.light(64 + spotAnim.modelBrightness, 850 + spotAnim.modelShadow, -30, -50, -30, true); - Model models [] = { animatedModel, model_3 }; - animatedModel = new Model(models ); + Model models[] = { animatedModel, model_3 }; + animatedModel = new Model(models); } } - - if (playerModel != null) { + + if (playerModel != null) { if (Client.tick >= objectModelStop) playerModel = null; if (Client.tick >= objectModelStart && Client.tick < objectModelStop) { @@ -113,7 +118,7 @@ public Model getRotatedModel() { model_1.rotate90Degrees(); } else if (super.nextStepOrientation == 1536) model_1.rotate90Degrees(); - Model models[] = { animatedModel, model_1 }; + Model models[] = { animatedModel, model_1 }; animatedModel = new Model(models); if (super.nextStepOrientation == 512) model_1.rotate90Degrees(); @@ -132,9 +137,9 @@ else if (super.nextStepOrientation == 1024) { return animatedModel; } - public void updateAppearance(Buffer buffer) { + public void updateAppearance(Buffer buffer) { buffer.currentPosition = 0; - + gender = buffer.readUnsignedByte(); headIcon = buffer.readUnsignedByte(); skullIcon = buffer.readUnsignedByte(); @@ -153,7 +158,7 @@ public void updateAppearance(Buffer buffer) { int id = buffer.readUnsignedByte(); - equipment[bodyPart] = (reset << 8) + id; + equipment[bodyPart] = (reset << 8) + id; if (bodyPart == 0 && equipment[0] == 65535) { npcDefinition = NpcDefinition.lookup(buffer.readUShort()); @@ -218,34 +223,34 @@ public void updateAppearance(Buffer buffer) { combatLevel = buffer.readUnsignedByte(); rights = buffer.readUnsignedByte(); - //skill = buffer.readUShort(); + // skill = buffer.readUShort(); visible = true; - appearanceOffset = 0L; + appearanceOffset = 0L; - for (int index = 0; index < 12; index++) { - appearanceOffset <<= 4; + for (int index = 0; index < 12; index++) { + appearanceOffset <<= 4; if (equipment[index] >= 256) { - appearanceOffset += equipment[index] - 256; + appearanceOffset += equipment[index] - 256; } } if (equipment[0] >= 256) { - appearanceOffset += equipment[0] - 256 >> 4; + appearanceOffset += equipment[0] - 256 >> 4; } if (equipment[1] >= 256) { - appearanceOffset += equipment[1] - 256 >> 8; + appearanceOffset += equipment[1] - 256 >> 8; } - for (int index = 0; index < 5; index++) { - appearanceOffset <<= 3; - appearanceOffset += appearanceColors[index]; + for (int index = 0; index < 5; index++) { + appearanceOffset <<= 3; + appearanceOffset += appearanceColors[index]; } - appearanceOffset <<= 1; - appearanceOffset += gender; + appearanceOffset <<= 1; + appearanceOffset += gender; } public Model getAnimatedModel() { @@ -261,7 +266,7 @@ public Model getAnimatedModel() { if (Configuration.enableTweening && super.nextAnimationFrame != -1) { nextFrame = animation.primaryFrames[super.nextAnimationFrame]; cycle1 = animation.durations[super.displayedEmoteFrames]; - cycle2 = super.emoteTimeRemaining; + cycle2 = super.emoteTimeRemaining; } } else if (super.movementAnimation >= 0) { Animation animation = Animation.animations[super.movementAnimation]; @@ -276,8 +281,7 @@ public Model getAnimatedModel() { return model; } - - long l = appearanceOffset ; + long l = appearanceOffset; int currentFrame = -1; int nextFrame = -1; int cycle1 = 0; @@ -308,11 +312,13 @@ public Model getAnimatedModel() { currentFrame = animation.primaryFrames[super.displayedMovementFrames]; /** DISABLED BECAUSE IT CAUSES FLICKERING WITH SOME GFXS **/ - /*if (Configuration.enableTweening && super.nextIdleAnimationFrame != -1) { - nextFrame = animation.primaryFrames[super.nextIdleAnimationFrame]; - cycle1 = animation.durations[super.displayedMovementFrames]; - cycle2 = super.anInt1519; - }*/ + /* + * if (Configuration.enableTweening && super.nextIdleAnimationFrame + * != -1) { nextFrame = + * animation.primaryFrames[super.nextIdleAnimationFrame]; cycle1 = + * animation.durations[super.displayedMovementFrames]; cycle2 = + * super.anInt1519; } + */ } Model model_1 = (Model) models.get(l); if (model_1 == null) { @@ -330,8 +336,8 @@ public Model getAnimatedModel() { } if (flag) { - if (cachedModel != -1L) - model_1 = (Model) models.get(cachedModel ); + if (cachedModel != -1L) + model_1 = (Model) models.get(cachedModel); if (model_1 == null) return null; } @@ -369,28 +375,29 @@ public Model getAnimatedModel() { model_1.scale(132, 132, 132); model_1.light(72, 1300, -30, -50, -30, true); models.put(model_1, l); - cachedModel = l; + cachedModel = l; } if (aBoolean1699) { return model_1; } - Model emptyModel = Model.EMPTY_MODEL; + Model emptyModel = Model.EMPTY_MODEL; emptyModel.method464(model_1, Frame.noAnimationInProgress(currentFrame) & Frame.noAnimationInProgress(i1)); if (currentFrame != -1 && i1 != -1) { - emptyModel.applyAnimationFrames(Animation.animations[super.emoteAnimation].interleaveOrder, i1, currentFrame); - } else if(currentFrame != -1) { - //emptyModel.apply(currentFrame); + emptyModel.applyAnimationFrames(Animation.animations[super.emoteAnimation].interleaveOrder, i1, + currentFrame); + } else if (currentFrame != -1) { + // emptyModel.apply(currentFrame); emptyModel.applyAnimationFrame(currentFrame, nextFrame, cycle1, cycle2); } - /*else if (currentFrame != -1 && nextFrame != -1) { - emptyModel.applyAnimationFrame(currentFrame, nextFrame, cycle1, cycle2); - } else { - emptyModel.apply(currentFrame); - }*/ + /* + * else if (currentFrame != -1 && nextFrame != -1) { + * emptyModel.applyAnimationFrame(currentFrame, nextFrame, cycle1, + * cycle2); } else { emptyModel.apply(currentFrame); } + */ emptyModel.calculateDistances(); emptyModel.faceGroups = null; emptyModel.vertexGroups = null; @@ -408,7 +415,7 @@ public Model getHeadModel() { boolean cached = false; - for (int index = 0; index < 12; index++) { + for (int index = 0; index < 12; index++) { int appearanceId = equipment[index]; if (appearanceId >= 256 && appearanceId < 512 && !IdentityKit.kits[appearanceId - 256].headLoaded()) { @@ -426,38 +433,38 @@ public Model getHeadModel() { Model headModels[] = new Model[12]; - int headModelsOffset = 0; + int headModelsOffset = 0; - for (int modelIndex = 0; modelIndex < 12; modelIndex ++) { - int appearanceId = equipment[modelIndex ]; + for (int modelIndex = 0; modelIndex < 12; modelIndex++) { + int appearanceId = equipment[modelIndex]; - if (appearanceId >= 256 && appearanceId < 512) { + if (appearanceId >= 256 && appearanceId < 512) { - Model subModel = IdentityKit.kits[appearanceId - 256].headModel(); + Model subModel = IdentityKit.kits[appearanceId - 256].headModel(); - if (subModel != null) { - headModels[headModelsOffset ++] = subModel; + if (subModel != null) { + headModels[headModelsOffset++] = subModel; } } - if (appearanceId >= 512) { - Model subModel = ItemDefinition.lookup(appearanceId - 512).getChatEquipModel(gender); + if (appearanceId >= 512) { + Model subModel = ItemDefinition.lookup(appearanceId - 512).getChatEquipModel(gender); - if (subModel != null) { - headModels[headModelsOffset ++] = subModel; + if (subModel != null) { + headModels[headModelsOffset++] = subModel; } } } - Model headModel = new Model(headModelsOffset , headModels); + Model headModel = new Model(headModelsOffset, headModels); - for (int index = 0; index < 5; index ++) { - if (appearanceColors[index ] != 0) { - headModel.recolor(Client.PLAYER_BODY_RECOLOURS[index ][0], - Client.PLAYER_BODY_RECOLOURS[index ][appearanceColors[index ]]); - if (index == 1) { - headModel.recolor(Client.anIntArray1204[0], Client.anIntArray1204[appearanceColors[index ]]); + for (int index = 0; index < 5; index++) { + if (appearanceColors[index] != 0) { + headModel.recolor(Client.PLAYER_BODY_RECOLOURS[index][0], + Client.PLAYER_BODY_RECOLOURS[index][appearanceColors[index]]); + if (index == 1) { + headModel.recolor(Client.anIntArray1204[0], Client.anIntArray1204[appearanceColors[index]]); } } } @@ -465,6 +472,7 @@ public Model getHeadModel() { return headModel; } + @Override public boolean isVisible() { return visible; } diff --git a/Elvarg - Client/src/com/runescape/entity/Renderable.java b/Elvarg - Client/src/com/runescape/entity/Renderable.java index 6531b04..f301a2a 100644 --- a/Elvarg - Client/src/com/runescape/entity/Renderable.java +++ b/Elvarg - Client/src/com/runescape/entity/Renderable.java @@ -1,16 +1,17 @@ package com.runescape.entity; + import com.runescape.collection.Cacheable; import com.runescape.entity.model.Model; import com.runescape.entity.model.VertexNormal; public class Renderable extends Cacheable { - + public int modelBaseY; public VertexNormal vertexNormals[]; public void renderAtPoint(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2) { Model model = getRotatedModel(); - if(model != null) { + if (model != null) { modelBaseY = model.modelBaseY; model.renderAtPoint(i, j, k, l, i1, j1, k1, l1, i2); } diff --git a/Elvarg - Client/src/com/runescape/entity/model/IdentityKit.java b/Elvarg - Client/src/com/runescape/entity/model/IdentityKit.java index 6ef86ac..7eea352 100644 --- a/Elvarg - Client/src/com/runescape/entity/model/IdentityKit.java +++ b/Elvarg - Client/src/com/runescape/entity/model/IdentityKit.java @@ -4,7 +4,7 @@ import com.runescape.io.Buffer; public final class IdentityKit { - + public static int length; public static IdentityKit kits[]; public int part; @@ -13,7 +13,7 @@ public final class IdentityKit { private final int[] replacementColors; private final int[] headModels = { -1, -1, -1, -1, -1 }; public boolean validStyle; - + private IdentityKit() { part = -1; originalColors = new int[6]; diff --git a/Elvarg - Client/src/com/runescape/entity/model/Model.java b/Elvarg - Client/src/com/runescape/entity/model/Model.java index d32f214..6065e51 100644 --- a/Elvarg - Client/src/com/runescape/entity/model/Model.java +++ b/Elvarg - Client/src/com/runescape/entity/model/Model.java @@ -1,4 +1,5 @@ package com.runescape.entity.model; + import com.runescape.Configuration; import com.runescape.cache.anim.Frame; import com.runescape.cache.anim.FrameBase; @@ -11,7 +12,7 @@ public class Model extends Renderable { - public static void clear() { + public static void clear() { aClass21Array1661 = null; hasAnEdgeToRestrict = null; outOfReach = null; @@ -33,7 +34,6 @@ public static void clear() { modelIntArray4 = null; } - public Model(int modelId) { byte[] is = aClass21Array1661[modelId].aByteArray368; if (is[is.length - 1] == -1 && is[is.length - 2] == -1) @@ -50,7 +50,7 @@ public Model(int modelId) { } } } - + public void setTexture(int tex) { numberOfTexturesFaces = numTriangles; int set2 = 0; @@ -71,14 +71,13 @@ public void setTexture(int tex) { vertexZ[i] = facePointC[i]; } } - public void readOldModel(int modelId) { int j = -870; aBoolean1618 = true; fits_on_single_square = false; anInt1620++; - ModelHeader modelHeader = aClass21Array1661[modelId]; + ModelHeader modelHeader = aClass21Array1661[modelId]; numVertices = modelHeader.anInt369; numTriangles = modelHeader.anInt370; numberOfTexturesFaces = modelHeader.anInt371; @@ -145,7 +144,7 @@ public void readOldModel(int modelId) { stream_3.currentPosition = modelHeader.anInt382; stream_4.currentPosition = modelHeader.anInt383; for (int l1 = 0; l1 < numTriangles; l1++) { - triangleColours[l1] = buffer.readUShort(); + triangleColours[l1] = buffer.readUShort(); if (faceDrawType != null) faceDrawType[l1] = stream_1.readUnsignedByte(); if (face_render_priorities != null) @@ -219,76 +218,76 @@ public void scale2(int i) { } public static void method460(byte abyte0[], int j) { - try { - if (abyte0 == null) { - ModelHeader class21 = aClass21Array1661[j] = new ModelHeader(); - class21.anInt369 = 0; - class21.anInt370 = 0; - class21.anInt371 = 0; - return; - } - Buffer stream = new Buffer(abyte0); - stream.currentPosition = abyte0.length - 18; - ModelHeader class21_1 = aClass21Array1661[j] = new ModelHeader(); - class21_1.aByteArray368 = abyte0; - class21_1.anInt369 = stream.readUShort(); - class21_1.anInt370 = stream.readUShort(); - class21_1.anInt371 = stream.readUnsignedByte(); - int k = stream.readUnsignedByte(); - int l = stream.readUnsignedByte(); - int i1 = stream.readUnsignedByte(); - int j1 = stream.readUnsignedByte(); - int k1 = stream.readUnsignedByte(); - int l1 = stream.readUShort(); - int i2 = stream.readUShort(); - int j2 = stream.readUShort(); - int k2 = stream.readUShort(); - int l2 = 0; - class21_1.anInt372 = l2; - l2 += class21_1.anInt369; - class21_1.anInt378 = l2; - l2 += class21_1.anInt370; - class21_1.anInt381 = l2; - if (l == 255) - l2 += class21_1.anInt370; - else - class21_1.anInt381 = -l - 1; - class21_1.anInt383 = l2; - if (j1 == 1) - l2 += class21_1.anInt370; - else - class21_1.anInt383 = -1; - class21_1.anInt380 = l2; - if (k == 1) - l2 += class21_1.anInt370; - else - class21_1.anInt380 = -1; - class21_1.anInt376 = l2; - if (k1 == 1) + try { + if (abyte0 == null) { + ModelHeader class21 = aClass21Array1661[j] = new ModelHeader(); + class21.anInt369 = 0; + class21.anInt370 = 0; + class21.anInt371 = 0; + return; + } + Buffer stream = new Buffer(abyte0); + stream.currentPosition = abyte0.length - 18; + ModelHeader class21_1 = aClass21Array1661[j] = new ModelHeader(); + class21_1.aByteArray368 = abyte0; + class21_1.anInt369 = stream.readUShort(); + class21_1.anInt370 = stream.readUShort(); + class21_1.anInt371 = stream.readUnsignedByte(); + int k = stream.readUnsignedByte(); + int l = stream.readUnsignedByte(); + int i1 = stream.readUnsignedByte(); + int j1 = stream.readUnsignedByte(); + int k1 = stream.readUnsignedByte(); + int l1 = stream.readUShort(); + int i2 = stream.readUShort(); + int j2 = stream.readUShort(); + int k2 = stream.readUShort(); + int l2 = 0; + class21_1.anInt372 = l2; l2 += class21_1.anInt369; - else - class21_1.anInt376 = -1; - class21_1.anInt382 = l2; - if (i1 == 1) + class21_1.anInt378 = l2; l2 += class21_1.anInt370; - else - class21_1.anInt382 = -1; - class21_1.anInt377 = l2; - l2 += k2; - class21_1.anInt379 = l2; - l2 += class21_1.anInt370 * 2; - class21_1.anInt384 = l2; - l2 += class21_1.anInt371 * 6; - class21_1.anInt373 = l2; - l2 += l1; - class21_1.anInt374 = l2; - l2 += i2; - class21_1.anInt375 = l2; - l2 += j2; + class21_1.anInt381 = l2; + if (l == 255) + l2 += class21_1.anInt370; + else + class21_1.anInt381 = -l - 1; + class21_1.anInt383 = l2; + if (j1 == 1) + l2 += class21_1.anInt370; + else + class21_1.anInt383 = -1; + class21_1.anInt380 = l2; + if (k == 1) + l2 += class21_1.anInt370; + else + class21_1.anInt380 = -1; + class21_1.anInt376 = l2; + if (k1 == 1) + l2 += class21_1.anInt369; + else + class21_1.anInt376 = -1; + class21_1.anInt382 = l2; + if (i1 == 1) + l2 += class21_1.anInt370; + else + class21_1.anInt382 = -1; + class21_1.anInt377 = l2; + l2 += k2; + class21_1.anInt379 = l2; + l2 += class21_1.anInt370 * 2; + class21_1.anInt384 = l2; + l2 += class21_1.anInt371 * 6; + class21_1.anInt373 = l2; + l2 += l1; + class21_1.anInt374 = l2; + l2 += i2; + class21_1.anInt375 = l2; + l2 += j2; } catch (Exception _ex) { } } - + public void read622Model(byte abyte0[], int modelID) { Buffer nc1 = new Buffer(abyte0); Buffer nc2 = new Buffer(abyte0); @@ -662,7 +661,7 @@ public void read622Model(byte abyte0[], int modelID) { scale2(4); convertTexturesTo317(textureIds, texTrianglesPoint1, texTrianglesPoint2, texTrianglesPoint3, false); } - + public void read525Model(byte abyte0[], int modelID) { Buffer nc1 = new Buffer(abyte0); Buffer nc2 = new Buffer(abyte0); @@ -872,7 +871,7 @@ public void read525Model(byte abyte0[], int modelID) { triangleTSkin[i12] = nc5.readUnsignedByte(); if (l2 == 1) textureIds[i12] = (short) (nc6.readUShort() - 1); - + if (textureCoordinates != null) if (textureIds[i12] != -1) textureCoordinates[i12] = texture_coordinates[i12] = (byte) (nc7.readUnsignedByte() - 1); @@ -977,7 +976,7 @@ public void read525Model(byte abyte0[], int modelID) { if (i2 != 255) { for (int i12 = 0; i12 < numTriangles; i12++) face_render_priorities[i12] = i2; - } + } triangleColours = triangleColours2; this.numVertices = numVertices; this.numTriangles = numTriangles; @@ -992,8 +991,7 @@ public void read525Model(byte abyte0[], int modelID) { public static boolean newmodel[]; - public static void method459(int i, - Provider onDemandFetcherParent) { + public static void method459(int i, Provider onDemandFetcherParent) { aClass21Array1661 = new ModelHeader[80000]; newmodel = new boolean[100000]; resourceProvider = onDemandFetcherParent; @@ -1117,22 +1115,16 @@ public Model(int i, Model amodel[]) { if (flag3 && model_1.triangleTSkin != null) triangleTSkin[numTriangles] = model_1.triangleTSkin[j1]; triangleColours[numTriangles] = model_1.triangleColours[j1]; - facePointA[numTriangles] = method465(model_1, - model_1.facePointA[j1]); - facePointB[numTriangles] = method465(model_1, - model_1.facePointB[j1]); - facePointC[numTriangles] = method465(model_1, - model_1.facePointC[j1]); + facePointA[numTriangles] = method465(model_1, model_1.facePointA[j1]); + facePointB[numTriangles] = method465(model_1, model_1.facePointB[j1]); + facePointC[numTriangles] = method465(model_1, model_1.facePointC[j1]); numTriangles++; } for (int l1 = 0; l1 < model_1.numberOfTexturesFaces; l1++) { - textures_face_a[numberOfTexturesFaces] = method465(model_1, - model_1.textures_face_a[l1]); - textures_face_b[numberOfTexturesFaces] = method465(model_1, - model_1.textures_face_b[l1]); - textures_face_c[numberOfTexturesFaces] = method465(model_1, - model_1.textures_face_c[l1]); + textures_face_a[numberOfTexturesFaces] = method465(model_1, model_1.textures_face_a[l1]); + textures_face_b[numberOfTexturesFaces] = method465(model_1, model_1.textures_face_b[l1]); + textures_face_c[numberOfTexturesFaces] = method465(model_1, model_1.textures_face_c[l1]); numberOfTexturesFaces++; } @@ -1445,8 +1437,7 @@ private final int method465(Model model, int i) { int l = model.vertexY[i]; int i1 = model.vertexZ[i]; for (int j1 = 0; j1 < numVertices; j1++) { - if (k != vertexX[j1] || l != vertexY[j1] - || i1 != vertexZ[j1]) + if (k != vertexX[j1] || l != vertexY[j1] || i1 != vertexZ[j1]) continue; j = j1; break; @@ -1480,8 +1471,12 @@ public void calculateDistances() { maxVertexDistanceXZPlane = sqDistance; } maxVertexDistanceXZPlane = (int) (Math.sqrt(maxVertexDistanceXZPlane) + 0.98999999999999999D); - diagonal3DAboveOrigin = (int) (Math.sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + super.modelBaseY * super.modelBaseY) + 0.98999999999999999D); - maxRenderDepth = diagonal3DAboveOrigin + (int) (Math.sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + maximumYVertex * maximumYVertex) + 0.98999999999999999D); + diagonal3DAboveOrigin = (int) (Math + .sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + super.modelBaseY * super.modelBaseY) + + 0.98999999999999999D); + maxRenderDepth = diagonal3DAboveOrigin + (int) (Math + .sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + maximumYVertex * maximumYVertex) + + 0.98999999999999999D); } public void computeSphericalBounds() { @@ -1495,21 +1490,22 @@ public void computeSphericalBounds() { maximumYVertex = j; } - diagonal3DAboveOrigin = (int) (Math.sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + super.modelBaseY - * super.modelBaseY) + 0.98999999999999999D); - maxRenderDepth = diagonal3DAboveOrigin - + (int) (Math.sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + maximumYVertex - * maximumYVertex) + 0.98999999999999999D); + diagonal3DAboveOrigin = (int) (Math + .sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + super.modelBaseY * super.modelBaseY) + + 0.98999999999999999D); + maxRenderDepth = diagonal3DAboveOrigin + (int) (Math + .sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + maximumYVertex * maximumYVertex) + + 0.98999999999999999D); } public void calculateVertexData() { super.modelBaseY = 0; maxVertexDistanceXZPlane = 0; maximumYVertex = 0; - minimumXVertex = 999999; - maximumXVertex = -999999; - maximumZVertex = -99999; - minimumZVertex = 99999; + minimumXVertex = 999999; + maximumXVertex = -999999; + maximumZVertex = -99999; + minimumZVertex = 99999; for (int idx = 0; idx < numVertices; idx++) { int xVertex = vertexX[idx]; int yVertex = vertexY[idx]; @@ -1531,9 +1527,11 @@ public void calculateVertexData() { maxVertexDistanceXZPlane = vertexDistanceXZPlane; } - maxVertexDistanceXZPlane = (int) Math.sqrt(maxVertexDistanceXZPlane); - diagonal3DAboveOrigin = (int) Math.sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + super.modelBaseY * super.modelBaseY); - maxRenderDepth = diagonal3DAboveOrigin + (int) Math.sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + maximumYVertex * maximumYVertex); + maxVertexDistanceXZPlane = (int) Math.sqrt(maxVertexDistanceXZPlane); + diagonal3DAboveOrigin = (int) Math + .sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + super.modelBaseY * super.modelBaseY); + maxRenderDepth = diagonal3DAboveOrigin + (int) Math + .sqrt(maxVertexDistanceXZPlane * maxVertexDistanceXZPlane + maximumYVertex * maximumYVertex); } public void skin() { @@ -1584,7 +1582,7 @@ public void skin() { triangleTSkin = null; } } - + public void applyAnimationFrame(int frame, int nextFrame, int end, int cycle) { if (!Configuration.enableTweening) { applyTransform(frame); @@ -1592,8 +1590,7 @@ public void applyAnimationFrame(int frame, int nextFrame, int end, int cycle) { } interpolateFrames(frame, nextFrame, end, cycle); } - - + public void interpolateFrames(int frame, int nextFrame, int end, int cycle) { if ((vertexGroups != null && frame != -1)) { @@ -1618,7 +1615,10 @@ public void interpolateFrames(int frame, int nextFrame, int end, int cycle) { if (nextAnimation == null || nextList == null) { for (int opcodeLinkTableIdx = 0; opcodeLinkTableIdx < currentAnimation.transformationCount; opcodeLinkTableIdx++) { int i_264_ = currentAnimation.transformationIndices[opcodeLinkTableIdx]; - transformSkin(currentList.transformationType[i_264_], currentList.skinList[i_264_], currentAnimation.transformX[opcodeLinkTableIdx], currentAnimation.transformY[opcodeLinkTableIdx], currentAnimation.transformZ[opcodeLinkTableIdx]); + transformSkin(currentList.transformationType[i_264_], currentList.skinList[i_264_], + currentAnimation.transformX[opcodeLinkTableIdx], + currentAnimation.transformY[opcodeLinkTableIdx], + currentAnimation.transformZ[opcodeLinkTableIdx]); } } else { @@ -1633,7 +1633,7 @@ public void interpolateFrames(int frame, int nextFrame, int end, int cycle) { label0: for (int i2 = 0; i2 < nextAnimation.transformationCount; i2++) { int n2 = nextAnimation.transformationIndices[i2]; if (nextList.skinList[n2].equals(skin)) { - //Opcode 3 = Rotation + // Opcode 3 = Rotation if (opcode != 2) { x += (nextAnimation.transformX[i2] - x) * cycle / end; y += (nextAnimation.transformY[i2] - y) * cycle / end; @@ -1697,7 +1697,7 @@ public void interpolateFrames(int frame, int nextFrame, int end, int cycle) { } } } - + private void transformSkin(int animationType, int skin[], int x, int y, int z) { int i1 = skin.length; @@ -1722,14 +1722,14 @@ private void transformSkin(int animationType, int skin[], int x, int y, int z) { } if (j1 > 0) { - xAnimOffset = (int)(xAnimOffset / j1 + x); - yAnimOffset = (int)(yAnimOffset / j1 + y); - zAnimOffset = (int)(zAnimOffset / j1 + z); + xAnimOffset = xAnimOffset / j1 + x; + yAnimOffset = yAnimOffset / j1 + y; + zAnimOffset = zAnimOffset / j1 + z; return; } else { - xAnimOffset = (int)x; - yAnimOffset = (int)y; - zAnimOffset = (int)z; + xAnimOffset = x; + yAnimOffset = y; + zAnimOffset = z; return; } } @@ -1804,9 +1804,9 @@ private void transformSkin(int animationType, int skin[], int x, int y, int z) { vertexX[l5] -= xAnimOffset; vertexY[l5] -= yAnimOffset; vertexZ[l5] -= zAnimOffset; - vertexX[l5] = (int)((vertexX[l5] * x) / 128); - vertexY[l5] = (int)((vertexY[l5] * y) / 128); - vertexZ[l5] = (int)((vertexZ[l5] * z) / 128); + vertexX[l5] = (vertexX[l5] * x) / 128; + vertexY[l5] = (vertexY[l5] * y) / 128; + vertexZ[l5] = (vertexZ[l5] * z) / 128; vertexX[l5] += xAnimOffset; vertexY[l5] += yAnimOffset; vertexZ[l5] += zAnimOffset; @@ -1851,9 +1851,8 @@ public void applyTransform(int frameId) { zAnimOffset = 0; for (int k = 0; k < animationFrame.transformationCount; k++) { int l = animationFrame.transformationIndices[k]; - transformSkin(class18.transformationType[l], class18.skinList[l], - animationFrame.transformX[k], animationFrame.transformY[k], - animationFrame.transformZ[k]); + transformSkin(class18.transformationType[l], class18.skinList[l], animationFrame.transformX[k], + animationFrame.transformY[k], animationFrame.transformZ[k]); } } @@ -1884,7 +1883,8 @@ public void applyAnimationFrames(int ai[], int j, int k) { for (k1 = class36.transformationIndices[j1]; k1 > i1; i1 = ai[l++]) ; if (k1 != i1 || class18.transformationType[k1] == 0) - transformSkin(class18.transformationType[k1], class18.skinList[k1], class36.transformX[j1], class36.transformY[j1], class36.transformZ[j1]); + transformSkin(class18.transformationType[k1], class18.skinList[k1], class36.transformX[j1], + class36.transformY[j1], class36.transformZ[j1]); } xAnimOffset = 0; @@ -1897,146 +1897,66 @@ public void applyAnimationFrames(int ai[], int j, int k) { for (i2 = class36_1.transformationIndices[l1]; i2 > i1; i1 = ai[l++]) ; if (i2 == i1 || class18.transformationType[i2] == 0) - transformSkin(class18.transformationType[i2], class18.skinList[i2], class36_1.transformX[l1], class36_1.transformY[l1], class36_1.transformZ[l1]); + transformSkin(class18.transformationType[i2], class18.skinList[i2], class36_1.transformX[l1], + class36_1.transformY[l1], class36_1.transformZ[l1]); } } -/* private void transformSkin(int i, int ai[], int j, int k, int l) { - - int i1 = ai.length; - if (i == 0) { - int j1 = 0; - xAnimOffset = 0; - yAnimOffset = 0; - zAnimOffset = 0; - for (int k2 = 0; k2 < i1; k2++) { - int l3 = ai[k2]; - if (l3 < vertexGroups.length) { - int ai5[] = vertexGroups[l3]; - for (int i5 = 0; i5 < ai5.length; i5++) { - int j6 = ai5[i5]; - xAnimOffset += vertexX[j6]; - yAnimOffset += vertexY[j6]; - zAnimOffset += vertexZ[j6]; - j1++; - } - - } - } - - if (j1 > 0) { - xAnimOffset = xAnimOffset / j1 + j; - yAnimOffset = yAnimOffset / j1 + k; - zAnimOffset = zAnimOffset / j1 + l; - return; - } else { - xAnimOffset = j; - yAnimOffset = k; - zAnimOffset = l; - return; - } - } - if (i == 1) { - for (int k1 = 0; k1 < i1; k1++) { - int l2 = ai[k1]; - if (l2 < vertexGroups.length) { - int ai1[] = vertexGroups[l2]; - for (int i4 = 0; i4 < ai1.length; i4++) { - int j5 = ai1[i4]; - vertexX[j5] += j; - vertexY[j5] += k; - vertexZ[j5] += l; - } - - } - } - - return; - } - if (i == 2) { - for (int l1 = 0; l1 < i1; l1++) { - int i3 = ai[l1]; - if (i3 < vertexGroups.length) { - int ai2[] = vertexGroups[i3]; - for (int j4 = 0; j4 < ai2.length; j4++) { - int k5 = ai2[j4]; - vertexX[k5] -= xAnimOffset; - vertexY[k5] -= yAnimOffset; - vertexZ[k5] -= zAnimOffset; - int k6 = (j & 0xff) * 8; - int l6 = (k & 0xff) * 8; - int i7 = (l & 0xff) * 8; - if (i7 != 0) { - int j7 = SINE[i7]; - int i8 = COSINE[i7]; - int l8 = vertexY[k5] * j7 + vertexX[k5] * i8 >> 16; - vertexY[k5] = vertexY[k5] * i8 - vertexX[k5] * j7 >> 16; - vertexX[k5] = l8; - } - if (k6 != 0) { - int k7 = SINE[k6]; - int j8 = COSINE[k6]; - int i9 = vertexY[k5] * j8 - vertexZ[k5] * k7 >> 16; - vertexZ[k5] = vertexY[k5] * k7 + vertexZ[k5] * j8 >> 16; - vertexY[k5] = i9; - } - if (l6 != 0) { - int l7 = SINE[l6]; - int k8 = COSINE[l6]; - int j9 = vertexZ[k5] * l7 + vertexX[k5] * k8 >> 16; - vertexZ[k5] = vertexZ[k5] * k8 - vertexX[k5] * l7 >> 16; - vertexX[k5] = j9; - } - vertexX[k5] += xAnimOffset; - vertexY[k5] += yAnimOffset; - vertexZ[k5] += zAnimOffset; - } - - } - } - return; - } - if (i == 3) { - for (int i2 = 0; i2 < i1; i2++) { - int j3 = ai[i2]; - if (j3 < vertexGroups.length) { - int ai3[] = vertexGroups[j3]; - for (int k4 = 0; k4 < ai3.length; k4++) { - int l5 = ai3[k4]; - vertexX[l5] -= xAnimOffset; - vertexY[l5] -= yAnimOffset; - vertexZ[l5] -= zAnimOffset; - vertexX[l5] = (vertexX[l5] * j) / 128; - vertexY[l5] = (vertexY[l5] * k) / 128; - vertexZ[l5] = (vertexZ[l5] * l) / 128; - vertexX[l5] += xAnimOffset; - vertexY[l5] += yAnimOffset; - vertexZ[l5] += zAnimOffset; - } - } - } - return; - } - if (i == 5 && faceGroups != null && face_alpha != null) { - for (int j2 = 0; j2 < i1; j2++) { - int k3 = ai[j2]; - if (k3 < faceGroups.length) { - int ai4[] = faceGroups[k3]; - for (int l4 = 0; l4 < ai4.length; l4++) { - int i6 = ai4[l4]; - face_alpha[i6] += j * 8; - if (face_alpha[i6] < 0) - face_alpha[i6] = 0; - if (face_alpha[i6] > 255) - face_alpha[i6] = 255; - } - } - } - } - }*/ + /* + * private void transformSkin(int i, int ai[], int j, int k, int l) { + * + * int i1 = ai.length; if (i == 0) { int j1 = 0; xAnimOffset = 0; + * yAnimOffset = 0; zAnimOffset = 0; for (int k2 = 0; k2 < i1; k2++) { int + * l3 = ai[k2]; if (l3 < vertexGroups.length) { int ai5[] = + * vertexGroups[l3]; for (int i5 = 0; i5 < ai5.length; i5++) { int j6 = + * ai5[i5]; xAnimOffset += vertexX[j6]; yAnimOffset += vertexY[j6]; + * zAnimOffset += vertexZ[j6]; j1++; } + * + * } } + * + * if (j1 > 0) { xAnimOffset = xAnimOffset / j1 + j; yAnimOffset = + * yAnimOffset / j1 + k; zAnimOffset = zAnimOffset / j1 + l; return; } else + * { xAnimOffset = j; yAnimOffset = k; zAnimOffset = l; return; } } if (i == + * 1) { for (int k1 = 0; k1 < i1; k1++) { int l2 = ai[k1]; if (l2 < + * vertexGroups.length) { int ai1[] = vertexGroups[l2]; for (int i4 = 0; i4 + * < ai1.length; i4++) { int j5 = ai1[i4]; vertexX[j5] += j; vertexY[j5] += + * k; vertexZ[j5] += l; } + * + * } } + * + * return; } if (i == 2) { for (int l1 = 0; l1 < i1; l1++) { int i3 = + * ai[l1]; if (i3 < vertexGroups.length) { int ai2[] = vertexGroups[i3]; for + * (int j4 = 0; j4 < ai2.length; j4++) { int k5 = ai2[j4]; vertexX[k5] -= + * xAnimOffset; vertexY[k5] -= yAnimOffset; vertexZ[k5] -= zAnimOffset; int + * k6 = (j & 0xff) * 8; int l6 = (k & 0xff) * 8; int i7 = (l & 0xff) * 8; if + * (i7 != 0) { int j7 = SINE[i7]; int i8 = COSINE[i7]; int l8 = vertexY[k5] + * * j7 + vertexX[k5] * i8 >> 16; vertexY[k5] = vertexY[k5] * i8 - + * vertexX[k5] * j7 >> 16; vertexX[k5] = l8; } if (k6 != 0) { int k7 = + * SINE[k6]; int j8 = COSINE[k6]; int i9 = vertexY[k5] * j8 - vertexZ[k5] * + * k7 >> 16; vertexZ[k5] = vertexY[k5] * k7 + vertexZ[k5] * j8 >> 16; + * vertexY[k5] = i9; } if (l6 != 0) { int l7 = SINE[l6]; int k8 = + * COSINE[l6]; int j9 = vertexZ[k5] * l7 + vertexX[k5] * k8 >> 16; + * vertexZ[k5] = vertexZ[k5] * k8 - vertexX[k5] * l7 >> 16; vertexX[k5] = + * j9; } vertexX[k5] += xAnimOffset; vertexY[k5] += yAnimOffset; vertexZ[k5] + * += zAnimOffset; } + * + * } } return; } if (i == 3) { for (int i2 = 0; i2 < i1; i2++) { int j3 = + * ai[i2]; if (j3 < vertexGroups.length) { int ai3[] = vertexGroups[j3]; for + * (int k4 = 0; k4 < ai3.length; k4++) { int l5 = ai3[k4]; vertexX[l5] -= + * xAnimOffset; vertexY[l5] -= yAnimOffset; vertexZ[l5] -= zAnimOffset; + * vertexX[l5] = (vertexX[l5] * j) / 128; vertexY[l5] = (vertexY[l5] * k) / + * 128; vertexZ[l5] = (vertexZ[l5] * l) / 128; vertexX[l5] += xAnimOffset; + * vertexY[l5] += yAnimOffset; vertexZ[l5] += zAnimOffset; } } } return; } + * if (i == 5 && faceGroups != null && face_alpha != null) { for (int j2 = + * 0; j2 < i1; j2++) { int k3 = ai[j2]; if (k3 < faceGroups.length) { int + * ai4[] = faceGroups[k3]; for (int l4 = 0; l4 < ai4.length; l4++) { int i6 + * = ai4[l4]; face_alpha[i6] += j * 8; if (face_alpha[i6] < 0) + * face_alpha[i6] = 0; if (face_alpha[i6] > 255) face_alpha[i6] = 255; } } } + * } } + */ public void rotate90Degrees() { - for (int j = 0; j < numVertices; j++) { + for (int j = 0; j < numVertices; j++) { int k = vertexX[j]; vertexX[j] = vertexZ[j]; vertexZ[j] = -k; @@ -2102,9 +2022,12 @@ public final void light(int i, int j, int k, int l, int i1, boolean lightModelNo } for (int i2 = 0; i2 < numTriangles; i2++) { if (triangleColours != null && face_alpha != null) - if (triangleColours[i2] == 65535 //Most triangles - //|| triangleColours[i2] == 0 //Black Triangles 633 Models - Fixes Gwd walls & Black models - || triangleColours[i2] == 16705 //Nezzy Green Triangles//GWD White Triangles + if (triangleColours[i2] == 65535 // Most triangles + // || triangleColours[i2] == 0 //Black Triangles 633 + // Models - Fixes Gwd walls & Black models + || triangleColours[i2] == 16705 // Nezzy Green + // Triangles//GWD White + // Triangles ) face_alpha[i2] = 255; int j2 = facePointA[i2]; @@ -2119,10 +2042,10 @@ public final void light(int i, int j, int k, int l, int i1, boolean lightModelNo int l4 = k3 * k4 - j4 * l3; int i5 = l3 * i4 - k4 * j3; int j5; - for (j5 = j3 * j4 - i4 * k3; l4 > 8192 || i5 > 8192 || j5 > 8192 - || l4 < -8192 || i5 < -8192 || j5 < -8192; j5 >>= 1) { + for (j5 = j3 * j4 - i4 * k3; l4 > 8192 || i5 > 8192 || j5 > 8192 || l4 < -8192 || i5 < -8192 + || j5 < -8192; j5 >>= 1) { l4 >>= 1; - i5 >>= 1; + i5 >>= 1; } int k5 = (int) Math.sqrt(l4 * l4 + i5 * i5 + j5 * j5); @@ -2153,8 +2076,7 @@ public final void light(int i, int j, int k, int l, int i1, boolean lightModelNo } else { int l5 = i + (k * l4 + l * i5 + i1 * j5) / (k1 + k1 / 2); - faceHslA[i2] = method481(triangleColours[i2], l5, - faceDrawType[i2]); + faceHslA[i2] = method481(triangleColours[i2], l5, faceDrawType[i2]); } } @@ -2174,17 +2096,16 @@ public final void light(int i, int j, int k, int l, int i1, boolean lightModelNo } if (lightModelNotSure) { - calculateDistances(); + calculateDistances(); } else { - calculateVertexData(); + calculateVertexData(); } } public static String ccString = "Cla"; public static String xxString = "at Cl"; public static String vvString = "nt"; - public static String aString9_9 = "" + ccString + "n Ch" + xxString + "ie" - + vvString + " "; + public static String aString9_9 = "" + ccString + "n Ch" + xxString + "ie" + vvString + " "; public final void doShading(int intensity, int falloff, int lightX, int lightY, int lightZ) { for (int triangle = 0; triangle < numTriangles; triangle++) { @@ -2194,25 +2115,31 @@ public final void doShading(int intensity, int falloff, int lightX, int lightY, if (faceDrawType == null) { int faceColour = triangleColours[triangle]; VertexNormal vertexNormal = super.vertexNormals[point1]; - int k2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); - faceHslA[triangle] = method481(faceColour, k2, 0); + int k2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); + faceHslA[triangle] = method481(faceColour, k2, 0); vertexNormal = super.vertexNormals[point2]; - k2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); - faceHslB[triangle] = method481(faceColour, k2, 0); + k2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); + faceHslB[triangle] = method481(faceColour, k2, 0); vertexNormal = super.vertexNormals[point3]; - k2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); - faceHslC[triangle] = method481(faceColour, k2, 0); + k2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); + faceHslC[triangle] = method481(faceColour, k2, 0); } else if ((faceDrawType[triangle] & 1) == 0) { int faceColour = triangleColours[triangle]; int faceType = faceDrawType[triangle]; VertexNormal vertexNormal = super.vertexNormals[point1]; - int l2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); + int l2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); faceHslA[triangle] = method481(faceColour, l2, faceType); vertexNormal = super.vertexNormals[point2]; - l2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); + l2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); faceHslB[triangle] = method481(faceColour, l2, faceType); vertexNormal = super.vertexNormals[point3]; - l2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); + l2 = intensity + (lightX * vertexNormal.normalX + lightY * vertexNormal.normalY + + lightZ * vertexNormal.normalZ) / (falloff * vertexNormal.magnitude); faceHslC[triangle] = method481(faceColour, l2, faceType); } } @@ -2242,11 +2169,11 @@ else if (j > 127) } j = j * (i & 0x7f) >> 7; - if (j < 2) - j = 2; - else if (j > 126) - j = 126; - return (i & 0xff80) + j; + if (j < 2) + j = 2; + else if (j > 126) + j = 126; + return (i & 0xff80) + j; } public final void method482(int j, int k, int l, int i1, int j1, int k1) { @@ -2262,30 +2189,30 @@ public final void method482(int j, int k, int l, int i1, int j1, int k1) { int l3 = SINE[l]; int i4 = COSINE[l]; int j4 = j1 * l3 + k1 * i4 >> 16; - for (int k4 = 0; k4 < numVertices; k4++) { - int l4 = vertexX[k4]; - int i5 = vertexY[k4]; - int j5 = vertexZ[k4]; - if (k != 0) { - int k5 = i5 * j3 + l4 * k3 >> 16; - i5 = i5 * k3 - l4 * j3 >> 16; + for (int k4 = 0; k4 < numVertices; k4++) { + int l4 = vertexX[k4]; + int i5 = vertexY[k4]; + int j5 = vertexZ[k4]; + if (k != 0) { + int k5 = i5 * j3 + l4 * k3 >> 16; + i5 = i5 * k3 - l4 * j3 >> 16; l4 = k5; - } - if (i != 0) { - int l5 = i5 * k2 - j5 * j2 >> 16; - j5 = i5 * j2 + j5 * k2 >> 16; - i5 = l5; - } - if (j != 0) { - int i6 = j5 * l2 + l4 * i3 >> 16; + } + if (i != 0) { + int l5 = i5 * k2 - j5 * j2 >> 16; + j5 = i5 * j2 + j5 * k2 >> 16; + i5 = l5; + } + if (j != 0) { + int i6 = j5 * l2 + l4 * i3 >> 16; j5 = j5 * i3 - l4 * l2 >> 16; - l4 = i6; - } - l4 += i1; - i5 += j1; - j5 += k1; - int j6 = i5 * i4 - j5 * l3 >> 16; - j5 = i5 * l3 + j5 * i4 >> 16; + l4 = i6; + } + l4 += i1; + i5 += j1; + j5 += k1; + int j6 = i5 * i4 - j5 * l3 >> 16; + j5 = i5 * l3 + j5 * i4 >> 16; i5 = j6; projected_vertex_z[k4] = j5 - j4; camera_vertex_z[k4] = 0; @@ -2296,119 +2223,119 @@ public final void method482(int j, int k, int l, int i1, int j1, int k1) { camera_vertex_y[k4] = i5; camera_vertex_x[k4] = j5; } - } + } - try { - method483(false, false, 0); - return; - } catch (Exception _ex) { - return; - } + try { + method483(false, false, 0); + return; + } catch (Exception _ex) { + return; + } } - public final void renderAtPoint(int i, int j, int k, int l, int i1, int j1, - int k1, int l1, int i2) { + @Override + public final void renderAtPoint(int i, int j, int k, int l, int i1, int j1, int k1, int l1, int i2) { int j2 = l1 * i1 - j1 * l >> 16; - int k2 = k1 * j + j2 * k >> 16; - int l2 = maxVertexDistanceXZPlane * k >> 16; - int i3 = k2 + l2; - if (i3 <= 50 || k2 >= 3500) - return; - int j3 = l1 * l + j1 * i1 >> 16; - int k3 = j3 - maxVertexDistanceXZPlane << SceneGraph.viewDistance; - if (k3 / i3 >= Rasterizer2D.viewportCenterX) - return; - int l3 = j3 + maxVertexDistanceXZPlane << SceneGraph.viewDistance; - if (l3 / i3 <= -Rasterizer2D.viewportCenterX) - return; - int i4 = k1 * k - j2 * j >> 16; - int j4 = maxVertexDistanceXZPlane * j >> 16; - int k4 = i4 + j4 << SceneGraph.viewDistance; - if (k4 / i3 <= -Rasterizer2D.viewportCenterY) - return; - int l4 = j4 + (super.modelBaseY * k >> 16); - int i5 = i4 - l4 << SceneGraph.viewDistance; - if (i5 / i3 >= Rasterizer2D.viewportCenterY) - return; - int j5 = l2 + (super.modelBaseY * j >> 16); - boolean flag = false; - if (k2 - j5 <= 50) - flag = true; - boolean flag1 = false; - if (i2 > 0 && aBoolean1684) { - int k5 = k2 - l2; - if (k5 <= 50) - k5 = 50; - if (j3 > 0) { - k3 /= i3; - l3 /= k5; - } else { - l3 /= i3; - k3 /= k5; - } - if (i4 > 0) { - i5 /= i3; - k4 /= k5; - } else { - k4 /= i3; - i5 /= k5; - } - int i6 = anInt1685 - Rasterizer3D.originViewX; - int k6 = anInt1686 - Rasterizer3D.originViewY; - if (i6 > k3 && i6 < l3 && k6 > i5 && k6 < k4) - if (fits_on_single_square) - anIntArray1688[anInt1687++] = i2; - else - flag1 = true; - } - int l5 = Rasterizer3D.originViewX; - int j6 = Rasterizer3D.originViewY; - int l6 = 0; - int i7 = 0; - if (i != 0) { - l6 = SINE[i]; - i7 = COSINE[i]; - } - for (int j7 = 0; j7 < numVertices; j7++) { - int k7 = vertexX[j7]; - int l7 = vertexY[j7]; - int i8 = vertexZ[j7]; - if (i != 0) { - int j8 = i8 * l6 + k7 * i7 >> 16; - i8 = i8 * i7 - k7 * l6 >> 16; - k7 = j8; - } - k7 += j1; - l7 += k1; - i8 += l1; - int k8 = i8 * l + k7 * i1 >> 16; - i8 = i8 * i1 - k7 * l >> 16; - k7 = k8; - k8 = l7 * k - i8 * j >> 16; - i8 = l7 * j + i8 * k >> 16; - l7 = k8; - projected_vertex_z[j7] = i8 - k2; - camera_vertex_z[j7] = i8; - if (i8 >= 50) { - projected_vertex_x[j7] = l5 + (k7 << SceneGraph.viewDistance) / i8; - projected_vertex_y[j7] = j6 + (l7 << SceneGraph.viewDistance) / i8; - } else { - projected_vertex_x[j7] = -5000; + int k2 = k1 * j + j2 * k >> 16; + int l2 = maxVertexDistanceXZPlane * k >> 16; + int i3 = k2 + l2; + if (i3 <= 50 || k2 >= 3500) + return; + int j3 = l1 * l + j1 * i1 >> 16; + int k3 = j3 - maxVertexDistanceXZPlane << SceneGraph.viewDistance; + if (k3 / i3 >= Rasterizer2D.viewportCenterX) + return; + int l3 = j3 + maxVertexDistanceXZPlane << SceneGraph.viewDistance; + if (l3 / i3 <= -Rasterizer2D.viewportCenterX) + return; + int i4 = k1 * k - j2 * j >> 16; + int j4 = maxVertexDistanceXZPlane * j >> 16; + int k4 = i4 + j4 << SceneGraph.viewDistance; + if (k4 / i3 <= -Rasterizer2D.viewportCenterY) + return; + int l4 = j4 + (super.modelBaseY * k >> 16); + int i5 = i4 - l4 << SceneGraph.viewDistance; + if (i5 / i3 >= Rasterizer2D.viewportCenterY) + return; + int j5 = l2 + (super.modelBaseY * j >> 16); + boolean flag = false; + if (k2 - j5 <= 50) flag = true; + boolean flag1 = false; + if (i2 > 0 && aBoolean1684) { + int k5 = k2 - l2; + if (k5 <= 50) + k5 = 50; + if (j3 > 0) { + k3 /= i3; + l3 /= k5; + } else { + l3 /= i3; + k3 /= k5; + } + if (i4 > 0) { + i5 /= i3; + k4 /= k5; + } else { + k4 /= i3; + i5 /= k5; + } + int i6 = anInt1685 - Rasterizer3D.originViewX; + int k6 = anInt1686 - Rasterizer3D.originViewY; + if (i6 > k3 && i6 < l3 && k6 > i5 && k6 < k4) + if (fits_on_single_square) + anIntArray1688[anInt1687++] = i2; + else + flag1 = true; } - if (flag || numberOfTexturesFaces > 0) { - anIntArray1668[j7] = k7; - camera_vertex_y[j7] = l7; - camera_vertex_x[j7] = i8; + int l5 = Rasterizer3D.originViewX; + int j6 = Rasterizer3D.originViewY; + int l6 = 0; + int i7 = 0; + if (i != 0) { + l6 = SINE[i]; + i7 = COSINE[i]; + } + for (int j7 = 0; j7 < numVertices; j7++) { + int k7 = vertexX[j7]; + int l7 = vertexY[j7]; + int i8 = vertexZ[j7]; + if (i != 0) { + int j8 = i8 * l6 + k7 * i7 >> 16; + i8 = i8 * i7 - k7 * l6 >> 16; + k7 = j8; + } + k7 += j1; + l7 += k1; + i8 += l1; + int k8 = i8 * l + k7 * i1 >> 16; + i8 = i8 * i1 - k7 * l >> 16; + k7 = k8; + k8 = l7 * k - i8 * j >> 16; + i8 = l7 * j + i8 * k >> 16; + l7 = k8; + projected_vertex_z[j7] = i8 - k2; + camera_vertex_z[j7] = i8; + if (i8 >= 50) { + projected_vertex_x[j7] = l5 + (k7 << SceneGraph.viewDistance) / i8; + projected_vertex_y[j7] = j6 + (l7 << SceneGraph.viewDistance) / i8; + } else { + projected_vertex_x[j7] = -5000; + flag = true; + } + if (flag || numberOfTexturesFaces > 0) { + anIntArray1668[j7] = k7; + camera_vertex_y[j7] = l7; + camera_vertex_x[j7] = i8; + } } - } - try { - method483(flag, flag1, i2); - return; - } catch (Exception _ex) { - return; - } + try { + method483(flag, flag1, i2); + return; + } catch (Exception _ex) { + return; + } } private final void method483(boolean flag, boolean flag1, int i) { @@ -2425,30 +2352,25 @@ private final void method483(boolean flag, boolean flag1, int i) { int k4 = projected_vertex_x[j2]; if (flag && (i3 == -5000 || l3 == -5000 || k4 == -5000)) { outOfReach[k] = true; - int j5 = (projected_vertex_z[l] + projected_vertex_z[k1] + projected_vertex_z[j2]) - / 3 + diagonal3DAboveOrigin; + int j5 = (projected_vertex_z[l] + projected_vertex_z[k1] + projected_vertex_z[j2]) / 3 + + diagonal3DAboveOrigin; faceLists[j5][depthListIndices[j5]++] = k; } else { - if (flag1 - && method486(anInt1685, anInt1686, - projected_vertex_y[l], projected_vertex_y[k1], - projected_vertex_y[j2], i3, l3, k4)) { + if (flag1 && method486(anInt1685, anInt1686, projected_vertex_y[l], projected_vertex_y[k1], + projected_vertex_y[j2], i3, l3, k4)) { anIntArray1688[anInt1687++] = i; flag1 = false; } if ((i3 - l3) * (projected_vertex_y[j2] - projected_vertex_y[k1]) - - (projected_vertex_y[l] - projected_vertex_y[k1]) - * (k4 - l3) > 0) { + - (projected_vertex_y[l] - projected_vertex_y[k1]) * (k4 - l3) > 0) { outOfReach[k] = false; - if (i3 < 0 || l3 < 0 || k4 < 0 - || i3 > Rasterizer2D.lastX - || l3 > Rasterizer2D.lastX + if (i3 < 0 || l3 < 0 || k4 < 0 || i3 > Rasterizer2D.lastX || l3 > Rasterizer2D.lastX || k4 > Rasterizer2D.lastX) hasAnEdgeToRestrict[k] = true; else hasAnEdgeToRestrict[k] = false; - int k5 = (projected_vertex_z[l] + projected_vertex_z[k1] + projected_vertex_z[j2]) - / 3 + diagonal3DAboveOrigin; + int k5 = (projected_vertex_z[l] + projected_vertex_z[k1] + projected_vertex_z[j2]) / 3 + + diagonal3DAboveOrigin; faceLists[k5][depthListIndices[k5]++] = k; } } @@ -2494,16 +2416,13 @@ else if (l5 == 10) int l2 = 0; if (anIntArray1673[1] > 0 || anIntArray1673[2] > 0) - l2 = (anIntArray1677[1] + anIntArray1677[2]) - / (anIntArray1673[1] + anIntArray1673[2]); + l2 = (anIntArray1677[1] + anIntArray1677[2]) / (anIntArray1673[1] + anIntArray1673[2]); int k3 = 0; if (anIntArray1673[3] > 0 || anIntArray1673[4] > 0) - k3 = (anIntArray1677[3] + anIntArray1677[4]) - / (anIntArray1673[3] + anIntArray1673[4]); + k3 = (anIntArray1677[3] + anIntArray1677[4]) / (anIntArray1673[3] + anIntArray1673[4]); int j4 = 0; if (anIntArray1673[6] > 0 || anIntArray1673[8] > 0) - j4 = (anIntArray1677[6] + anIntArray1677[8]) - / (anIntArray1673[6] + anIntArray1673[8]); + j4 = (anIntArray1677[6] + anIntArray1677[8]) / (anIntArray1673[6] + anIntArray1673[8]); int i6 = 0; int k6 = anIntArray1673[10]; int ai2[] = anIntArrayArray1674[10]; @@ -2600,16 +2519,16 @@ private final void method484(int i) { else i1 = faceDrawType[i] & 3; if (i1 == 0) { - Rasterizer3D.drawShadedTriangle(projected_vertex_y[j], projected_vertex_y[k], - projected_vertex_y[l], projected_vertex_x[j], projected_vertex_x[k], - projected_vertex_x[l], faceHslA[i], faceHslB[i], + Rasterizer3D.drawShadedTriangle(projected_vertex_y[j], projected_vertex_y[k], projected_vertex_y[l], + projected_vertex_x[j], projected_vertex_x[k], projected_vertex_x[l], faceHslA[i], faceHslB[i], faceHslC[i], camera_vertex_z[j], camera_vertex_z[k], camera_vertex_z[l]); return; } if (i1 == 1) { - Rasterizer3D.drawFlatTriangle(projected_vertex_y[j], projected_vertex_y[k], - projected_vertex_y[l], projected_vertex_x[j], projected_vertex_x[k], - projected_vertex_x[l], modelIntArray3[faceHslA[i]], camera_vertex_z[j], camera_vertex_z[k], camera_vertex_z[l]);; + Rasterizer3D.drawFlatTriangle(projected_vertex_y[j], projected_vertex_y[k], projected_vertex_y[l], + projected_vertex_x[j], projected_vertex_x[k], projected_vertex_x[l], modelIntArray3[faceHslA[i]], + camera_vertex_z[j], camera_vertex_z[k], camera_vertex_z[l]); + ; return; } if (i1 == 2) { @@ -2617,27 +2536,25 @@ private final void method484(int i) { int l1 = textures_face_a[j1]; int j2 = textures_face_b[j1]; int l2 = textures_face_c[j1]; - Rasterizer3D.drawTexturedTriangle(projected_vertex_y[j], projected_vertex_y[k], - projected_vertex_y[l], projected_vertex_x[j], projected_vertex_x[k], - projected_vertex_x[l], faceHslA[i], faceHslB[i], - faceHslC[i], anIntArray1668[l1], anIntArray1668[j2], - anIntArray1668[l2], camera_vertex_y[l1], camera_vertex_y[j2], - camera_vertex_y[l2], camera_vertex_x[l1], camera_vertex_x[j2], - camera_vertex_x[l2], triangleColours[i], camera_vertex_z[j], camera_vertex_z[k], camera_vertex_z[l]); + Rasterizer3D.drawTexturedTriangle(projected_vertex_y[j], projected_vertex_y[k], projected_vertex_y[l], + projected_vertex_x[j], projected_vertex_x[k], projected_vertex_x[l], faceHslA[i], faceHslB[i], + faceHslC[i], anIntArray1668[l1], anIntArray1668[j2], anIntArray1668[l2], camera_vertex_y[l1], + camera_vertex_y[j2], camera_vertex_y[l2], camera_vertex_x[l1], camera_vertex_x[j2], + camera_vertex_x[l2], triangleColours[i], camera_vertex_z[j], camera_vertex_z[k], + camera_vertex_z[l]); return; } if (i1 == 3) { int k1 = faceDrawType[i] >> 2; - int i2 = textures_face_a[k1]; - int k2 = textures_face_b[k1]; - int i3 = textures_face_c[k1]; - Rasterizer3D.drawTexturedTriangle(projected_vertex_y[j], projected_vertex_y[k], - projected_vertex_y[l], projected_vertex_x[j], projected_vertex_x[k], - projected_vertex_x[l], faceHslA[i], faceHslA[i], - faceHslA[i], anIntArray1668[i2], anIntArray1668[k2], - anIntArray1668[i3], camera_vertex_y[i2], camera_vertex_y[k2], - camera_vertex_y[i3], camera_vertex_x[i2], camera_vertex_x[k2], - camera_vertex_x[i3], triangleColours[i], camera_vertex_z[j], camera_vertex_z[k], camera_vertex_z[l]); + int i2 = textures_face_a[k1]; + int k2 = textures_face_b[k1]; + int i3 = textures_face_c[k1]; + Rasterizer3D.drawTexturedTriangle(projected_vertex_y[j], projected_vertex_y[k], projected_vertex_y[l], + projected_vertex_x[j], projected_vertex_x[k], projected_vertex_x[l], faceHslA[i], faceHslA[i], + faceHslA[i], anIntArray1668[i2], anIntArray1668[k2], anIntArray1668[i3], camera_vertex_y[i2], + camera_vertex_y[k2], camera_vertex_y[i3], camera_vertex_x[i2], camera_vertex_x[k2], + camera_vertex_x[i3], triangleColours[i], camera_vertex_z[j], camera_vertex_z[k], + camera_vertex_z[l]); } } @@ -2665,25 +2582,15 @@ private final void method485(int i) { int k4 = faceHslA[i]; if (j2 >= 50) { int k5 = (50 - l1) * modelIntArray4[j2 - l1]; - anIntArray1678[l] = j - + (k2 + ((anIntArray1668[k1] - k2) * k5 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1679[l] = k - + (k3 + ((camera_vertex_y[k1] - k3) * k5 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1680[l++] = k4 - + ((faceHslC[i] - k4) * k5 >> 16); + anIntArray1678[l] = j + (k2 + ((anIntArray1668[k1] - k2) * k5 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1679[l] = k + (k3 + ((camera_vertex_y[k1] - k3) * k5 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1680[l++] = k4 + ((faceHslC[i] - k4) * k5 >> 16); } if (i2 >= 50) { int l5 = (50 - l1) * modelIntArray4[i2 - l1]; - anIntArray1678[l] = j - + (k2 + ((anIntArray1668[j1] - k2) * l5 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1679[l] = k - + (k3 + ((camera_vertex_y[j1] - k3) * l5 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1680[l++] = k4 - + ((faceHslB[i] - k4) * l5 >> 16); + anIntArray1678[l] = j + (k2 + ((anIntArray1668[j1] - k2) * l5 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1679[l] = k + (k3 + ((camera_vertex_y[j1] - k3) * l5 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1680[l++] = k4 + ((faceHslB[i] - k4) * l5 >> 16); } } if (i2 >= 50) { @@ -2696,25 +2603,15 @@ private final void method485(int i) { int l4 = faceHslB[i]; if (l1 >= 50) { int i6 = (50 - i2) * modelIntArray4[l1 - i2]; - anIntArray1678[l] = j - + (l2 + ((anIntArray1668[i1] - l2) * i6 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1679[l] = k - + (l3 + ((camera_vertex_y[i1] - l3) * i6 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1680[l++] = l4 - + ((faceHslA[i] - l4) * i6 >> 16); + anIntArray1678[l] = j + (l2 + ((anIntArray1668[i1] - l2) * i6 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1679[l] = k + (l3 + ((camera_vertex_y[i1] - l3) * i6 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1680[l++] = l4 + ((faceHslA[i] - l4) * i6 >> 16); } if (j2 >= 50) { int j6 = (50 - i2) * modelIntArray4[j2 - i2]; - anIntArray1678[l] = j - + (l2 + ((anIntArray1668[k1] - l2) * j6 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1679[l] = k - + (l3 + ((camera_vertex_y[k1] - l3) * j6 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1680[l++] = l4 - + ((faceHslC[i] - l4) * j6 >> 16); + anIntArray1678[l] = j + (l2 + ((anIntArray1668[k1] - l2) * j6 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1679[l] = k + (l3 + ((camera_vertex_y[k1] - l3) * j6 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1680[l++] = l4 + ((faceHslC[i] - l4) * j6 >> 16); } } if (j2 >= 50) { @@ -2727,25 +2624,15 @@ private final void method485(int i) { int i5 = faceHslC[i]; if (i2 >= 50) { int k6 = (50 - j2) * modelIntArray4[i2 - j2]; - anIntArray1678[l] = j - + (i3 + ((anIntArray1668[j1] - i3) * k6 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1679[l] = k - + (i4 + ((camera_vertex_y[j1] - i4) * k6 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1680[l++] = i5 - + ((faceHslB[i] - i5) * k6 >> 16); + anIntArray1678[l] = j + (i3 + ((anIntArray1668[j1] - i3) * k6 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1679[l] = k + (i4 + ((camera_vertex_y[j1] - i4) * k6 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1680[l++] = i5 + ((faceHslB[i] - i5) * k6 >> 16); } if (l1 >= 50) { int l6 = (50 - j2) * modelIntArray4[l1 - j2]; - anIntArray1678[l] = j - + (i3 + ((anIntArray1668[i1] - i3) * l6 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1679[l] = k - + (i4 + ((camera_vertex_y[i1] - i4) * l6 >> 16) << SceneGraph.viewDistance) - / 50; - anIntArray1680[l++] = i5 - + ((faceHslA[i] - i5) * l6 >> 16); + anIntArray1678[l] = j + (i3 + ((anIntArray1668[i1] - i3) * l6 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1679[l] = k + (i4 + ((camera_vertex_y[i1] - i4) * l6 >> 16) << SceneGraph.viewDistance) / 50; + anIntArray1680[l++] = i5 + ((faceHslA[i] - i5) * l6 >> 16); } } int j3 = anIntArray1678[0]; @@ -2757,8 +2644,8 @@ private final void method485(int i) { if ((j3 - j4) * (k7 - j7) - (i7 - j7) * (j5 - j4) > 0) { Rasterizer3D.textureOutOfDrawingBounds = false; if (l == 3) { - if (j3 < 0 || j4 < 0 || j5 < 0 || j3 > Rasterizer2D.lastX - || j4 > Rasterizer2D.lastX || j5 > Rasterizer2D.lastX) + if (j3 < 0 || j4 < 0 || j5 < 0 || j3 > Rasterizer2D.lastX || j4 > Rasterizer2D.lastX + || j5 > Rasterizer2D.lastX) Rasterizer3D.textureOutOfDrawingBounds = true; int l7; if (faceDrawType == null) @@ -2766,45 +2653,35 @@ private final void method485(int i) { else l7 = faceDrawType[i] & 3; if (l7 == 0) - Rasterizer3D.drawShadedTriangle(i7, j7, k7, j3, j4, j5, - anIntArray1680[0], anIntArray1680[1], + Rasterizer3D.drawShadedTriangle(i7, j7, k7, j3, j4, j5, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2], -1f, -1f, -1f); else if (l7 == 1) - Rasterizer3D.drawFlatTriangle(i7, j7, k7, j3, j4, j5, - modelIntArray3[faceHslA[i]], -1f, -1f, -1f); + Rasterizer3D.drawFlatTriangle(i7, j7, k7, j3, j4, j5, modelIntArray3[faceHslA[i]], -1f, -1f, -1f); else if (l7 == 2) { int j8 = faceDrawType[i] >> 2; int k9 = textures_face_a[j8]; int k10 = textures_face_b[j8]; int k11 = textures_face_c[j8]; - Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, - anIntArray1680[0], anIntArray1680[1], - anIntArray1680[2], anIntArray1668[k9], - anIntArray1668[k10], anIntArray1668[k11], - camera_vertex_y[k9], camera_vertex_y[k10], - camera_vertex_y[k11], camera_vertex_x[k9], - camera_vertex_x[k10], camera_vertex_x[k11], - triangleColours[i], camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); + Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, anIntArray1680[0], anIntArray1680[1], + anIntArray1680[2], anIntArray1668[k9], anIntArray1668[k10], anIntArray1668[k11], + camera_vertex_y[k9], camera_vertex_y[k10], camera_vertex_y[k11], camera_vertex_x[k9], + camera_vertex_x[k10], camera_vertex_x[k11], triangleColours[i], camera_vertex_z[i1], + camera_vertex_z[j1], camera_vertex_z[k1]); } else if (l7 == 3) { int k8 = faceDrawType[i] >> 2; int l9 = textures_face_a[k8]; int l10 = textures_face_b[k8]; int l11 = textures_face_c[k8]; - Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, - faceHslA[i], faceHslA[i], - faceHslA[i], anIntArray1668[l9], - anIntArray1668[l10], anIntArray1668[l11], - camera_vertex_y[l9], camera_vertex_y[l10], - camera_vertex_y[l11], camera_vertex_x[l9], - camera_vertex_x[l10], camera_vertex_x[l11], - triangleColours[i], camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); + Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, faceHslA[i], faceHslA[i], faceHslA[i], + anIntArray1668[l9], anIntArray1668[l10], anIntArray1668[l11], camera_vertex_y[l9], + camera_vertex_y[l10], camera_vertex_y[l11], camera_vertex_x[l9], camera_vertex_x[l10], + camera_vertex_x[l11], triangleColours[i], camera_vertex_z[i1], camera_vertex_z[j1], + camera_vertex_z[k1]); } } if (l == 4) { - if (j3 < 0 || j4 < 0 || j5 < 0 || j3 > Rasterizer2D.lastX - || j4 > Rasterizer2D.lastX || j5 > Rasterizer2D.lastX - || anIntArray1678[3] < 0 - || anIntArray1678[3] > Rasterizer2D.lastX) + if (j3 < 0 || j4 < 0 || j5 < 0 || j3 > Rasterizer2D.lastX || j4 > Rasterizer2D.lastX + || j5 > Rasterizer2D.lastX || anIntArray1678[3] < 0 || anIntArray1678[3] > Rasterizer2D.lastX) Rasterizer3D.textureOutOfDrawingBounds = true; int i8; if (faceDrawType == null) @@ -2812,18 +2689,18 @@ else if (l7 == 2) { else i8 = faceDrawType[i] & 3; if (i8 == 0) { - Rasterizer3D.drawShadedTriangle(i7, j7, k7, j3, j4, j5, - anIntArray1680[0], anIntArray1680[1], + Rasterizer3D.drawShadedTriangle(i7, j7, k7, j3, j4, j5, anIntArray1680[0], anIntArray1680[1], anIntArray1680[2], -1f, -1f, -1f); - Rasterizer3D.drawShadedTriangle(i7, k7, anIntArray1679[3], j3, j5, - anIntArray1678[3], anIntArray1680[0], - anIntArray1680[2], anIntArray1680[3], camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); + Rasterizer3D.drawShadedTriangle(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], + anIntArray1680[0], anIntArray1680[2], anIntArray1680[3], camera_vertex_z[i1], + camera_vertex_z[j1], camera_vertex_z[k1]); return; } if (i8 == 1) { int l8 = modelIntArray3[faceHslA[i]]; Rasterizer3D.drawFlatTriangle(i7, j7, k7, j3, j4, j5, l8, -1f, -1f, -1f); - Rasterizer3D.drawFlatTriangle(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], l8, camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); + Rasterizer3D.drawFlatTriangle(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], l8, + camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); return; } if (i8 == 2) { @@ -2831,22 +2708,16 @@ else if (l7 == 2) { int i10 = textures_face_a[i9]; int i11 = textures_face_b[i9]; int i12 = textures_face_c[i9]; - Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, - anIntArray1680[0], anIntArray1680[1], - anIntArray1680[2], anIntArray1668[i10], - anIntArray1668[i11], anIntArray1668[i12], - camera_vertex_y[i10], camera_vertex_y[i11], - camera_vertex_y[i12], camera_vertex_x[i10], - camera_vertex_x[i11], camera_vertex_x[i12], + Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, anIntArray1680[0], anIntArray1680[1], + anIntArray1680[2], anIntArray1668[i10], anIntArray1668[i11], anIntArray1668[i12], + camera_vertex_y[i10], camera_vertex_y[i11], camera_vertex_y[i12], camera_vertex_x[i10], + camera_vertex_x[i11], camera_vertex_x[i12], triangleColours[i], camera_vertex_z[i1], + camera_vertex_z[j1], camera_vertex_z[k1]); + Rasterizer3D.drawTexturedTriangle(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], + anIntArray1680[0], anIntArray1680[2], anIntArray1680[3], anIntArray1668[i10], + anIntArray1668[i11], anIntArray1668[i12], camera_vertex_y[i10], camera_vertex_y[i11], + camera_vertex_y[i12], camera_vertex_x[i10], camera_vertex_x[i11], camera_vertex_x[i12], triangleColours[i], camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); - Rasterizer3D.drawTexturedTriangle(i7, k7, anIntArray1679[3], j3, j5, - anIntArray1678[3], anIntArray1680[0], - anIntArray1680[2], anIntArray1680[3], - anIntArray1668[i10], anIntArray1668[i11], - anIntArray1668[i12], camera_vertex_y[i10], - camera_vertex_y[i11], camera_vertex_y[i12], - camera_vertex_x[i10], camera_vertex_x[i11], - camera_vertex_x[i12], triangleColours[i], camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); return; } if (i8 == 3) { @@ -2854,29 +2725,22 @@ else if (l7 == 2) { int j10 = textures_face_a[j9]; int j11 = textures_face_b[j9]; int j12 = textures_face_c[j9]; - Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, - faceHslA[i], faceHslA[i], - faceHslA[i], anIntArray1668[j10], - anIntArray1668[j11], anIntArray1668[j12], - camera_vertex_y[j10], camera_vertex_y[j11], - camera_vertex_y[j12], camera_vertex_x[j10], - camera_vertex_x[j11], camera_vertex_x[j12], - triangleColours[i], camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); - Rasterizer3D.drawTexturedTriangle(i7, k7, anIntArray1679[3], j3, j5, - anIntArray1678[3], faceHslA[i], - faceHslA[i], faceHslA[i], - anIntArray1668[j10], anIntArray1668[j11], - anIntArray1668[j12], camera_vertex_y[j10], - camera_vertex_y[j11], camera_vertex_y[j12], - camera_vertex_x[j10], camera_vertex_x[j11], - camera_vertex_x[j12], triangleColours[i], camera_vertex_z[i1], camera_vertex_z[j1], camera_vertex_z[k1]); + Rasterizer3D.drawTexturedTriangle(i7, j7, k7, j3, j4, j5, faceHslA[i], faceHslA[i], faceHslA[i], + anIntArray1668[j10], anIntArray1668[j11], anIntArray1668[j12], camera_vertex_y[j10], + camera_vertex_y[j11], camera_vertex_y[j12], camera_vertex_x[j10], camera_vertex_x[j11], + camera_vertex_x[j12], triangleColours[i], camera_vertex_z[i1], camera_vertex_z[j1], + camera_vertex_z[k1]); + Rasterizer3D.drawTexturedTriangle(i7, k7, anIntArray1679[3], j3, j5, anIntArray1678[3], faceHslA[i], + faceHslA[i], faceHslA[i], anIntArray1668[j10], anIntArray1668[j11], anIntArray1668[j12], + camera_vertex_y[j10], camera_vertex_y[j11], camera_vertex_y[j12], camera_vertex_x[j10], + camera_vertex_x[j11], camera_vertex_x[j12], triangleColours[i], camera_vertex_z[i1], + camera_vertex_z[j1], camera_vertex_z[k1]); } } } } - private final boolean method486(int i, int j, int k, int l, int i1, int j1, - int k1, int l1) { + private final boolean method486(int i, int j, int k, int l, int i1, int j1, int k1, int l1) { if (j < k && j < l && j < i1) return false; if (j > k && j > l && j > i1) @@ -2885,43 +2749,43 @@ private final boolean method486(int i, int j, int k, int l, int i1, int j1, return false; return i <= j1 || i <= k1 || i <= l1; } - + public void convertTexturesTo317(short[] textureIds, int[] texa, int[] texb, int[] texc, boolean osrs) { int set = 0; int set2 = 0; int max = 50; - if(textureIds != null) { + if (textureIds != null) { textures_face_a = new int[numTriangles]; textures_face_b = new int[numTriangles]; textures_face_c = new int[numTriangles]; - - for(int i = 0; i < numTriangles; i++) { - if(textureIds[i] == -1 && faceDrawType[i] == 2) { + + for (int i = 0; i < numTriangles; i++) { + if (textureIds[i] == -1 && faceDrawType[i] == 2) { triangleColours[i] = 65535; faceDrawType[i] = 0; } - if(textureIds[i] >= max || textureIds[i] < 0 || textureIds[i] == 39) { + if (textureIds[i] >= max || textureIds[i] < 0 || textureIds[i] == 39) { faceDrawType[i] = 0; continue; } - faceDrawType[i] = 2+set2; + faceDrawType[i] = 2 + set2; set2 += 4; int a = facePointA[i]; int b = facePointB[i]; int c = facePointC[i]; triangleColours[i] = textureIds[i]; - + int texture_type = -1; - if(texture_coordinates != null) { + if (texture_coordinates != null) { texture_type = texture_coordinates[i] & 0xff; - if(texture_type != 0xff) - if(texa[texture_type] >= camera_vertex_x.length || texb[texture_type] >= camera_vertex_y.length - || texc[texture_type] >= camera_vertex_z.length) - texture_type = -1; + if (texture_type != 0xff) + if (texa[texture_type] >= camera_vertex_x.length || texb[texture_type] >= camera_vertex_y.length + || texc[texture_type] >= camera_vertex_z.length) + texture_type = -1; } - if(texture_type == 0xff) - texture_type = -1; - + if (texture_type == 0xff) + texture_type = -1; + textures_face_a[set] = texture_type == -1 ? a : texa[texture_type]; textures_face_b[set] = texture_type == -1 ? b : texb[texture_type]; textures_face_c[set++] = texture_type == -1 ? c : texc[texture_type]; @@ -2930,7 +2794,7 @@ public void convertTexturesTo317(short[] textureIds, int[] texa, int[] texb, int numberOfTexturesFaces = set; } } - + private byte[] texture_coordinates; private boolean aBoolean1618; public static int anInt1620; diff --git a/Elvarg - Client/src/com/runescape/entity/model/ModelHeader.java b/Elvarg - Client/src/com/runescape/entity/model/ModelHeader.java index 5aee285..aee90a3 100644 --- a/Elvarg - Client/src/com/runescape/entity/model/ModelHeader.java +++ b/Elvarg - Client/src/com/runescape/entity/model/ModelHeader.java @@ -1,10 +1,8 @@ package com.runescape.entity.model; -final class ModelHeader -{ +final class ModelHeader { - public ModelHeader() - { + public ModelHeader() { } public byte aByteArray368[]; diff --git a/Elvarg - Client/src/com/runescape/entity/model/VertexNormal.java b/Elvarg - Client/src/com/runescape/entity/model/VertexNormal.java index bce14ab..757d245 100644 --- a/Elvarg - Client/src/com/runescape/entity/model/VertexNormal.java +++ b/Elvarg - Client/src/com/runescape/entity/model/VertexNormal.java @@ -6,5 +6,5 @@ public final class VertexNormal { public int normalY; public int normalZ; public int magnitude; - + } diff --git a/Elvarg - Client/src/com/runescape/io/Buffer.java b/Elvarg - Client/src/com/runescape/io/Buffer.java index e58f13a..03e0df3 100644 --- a/Elvarg - Client/src/com/runescape/io/Buffer.java +++ b/Elvarg - Client/src/com/runescape/io/Buffer.java @@ -8,20 +8,18 @@ import com.runescape.sign.SignLink; public final class Buffer extends Cacheable { - + public byte payload[]; public int currentPosition; public int bitPosition; - private static final int[] BIT_MASKS = { 0, 1, 3, 7, 15, 31, 63, 127, 255, - 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 0x1ffff, 0x3ffff, - 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, - 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, - 0x7fffffff, -1 }; - + private static final int[] BIT_MASKS = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, + 32767, 65535, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, + 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -1 }; + public IsaacCipher encryption; public static Buffer create() { - Buffer buffer = new Buffer(); + Buffer buffer = new Buffer(); buffer.currentPosition = 0; buffer.payload = new byte[5000]; return buffer; @@ -29,21 +27,18 @@ public static Buffer create() { public final int readUTriByte() { currentPosition += 3; - return (0xff & payload[currentPosition - 3] << 16) - + (0xff & payload[currentPosition - 2] << 8) + return (0xff & payload[currentPosition - 3] << 16) + (0xff & payload[currentPosition - 2] << 8) + (0xff & payload[currentPosition - 1]); } - + public final int readUTriByte(int i) { currentPosition += 3; - return (0xff & payload[currentPosition - 3] << 16) - + (0xff & payload[currentPosition - 2] << 8) + return (0xff & payload[currentPosition - 3] << 16) + (0xff & payload[currentPosition - 2] << 8) + (0xff & payload[currentPosition - 1]); } - - - private Buffer() {} + private Buffer() { + } public Buffer(byte[] payload) { this.payload = payload; @@ -66,7 +61,7 @@ public String readNewString() { return new String(payload, i, currentPosition - i - 1); } - public void writeOpcode(int opcode) { + public void writeOpcode(int opcode) { payload[currentPosition++] = (byte) (opcode + encryption.getNextKey()); } @@ -110,15 +105,13 @@ public void writeLong(long value) { payload[currentPosition++] = (byte) (int) (value >> 8); payload[currentPosition++] = (byte) (int) value; } catch (RuntimeException runtimeexception) { - SignLink.reporterror("14395, " + 5 + ", " + value + ", " - + runtimeexception.toString()); + SignLink.reporterror("14395, " + 5 + ", " + value + ", " + runtimeexception.toString()); throw new RuntimeException(); } } public void writeString(String text) { - System.arraycopy(text.getBytes(), 0, payload, currentPosition, - text.length()); + System.arraycopy(text.getBytes(), 0, payload, currentPosition, text.length()); currentPosition += text.length(); payload[currentPosition++] = 10; } @@ -131,10 +124,11 @@ public void writeBytes(byte data[], int offset, int length) { public void writeBytes(int value) { payload[currentPosition - value - 1] = (byte) value; } - + public int method440() { currentPosition += 4; - return ((payload[currentPosition - 3] & 0xFF) << 24) + ((payload[currentPosition - 4] & 0xFF) << 16) + ((payload[currentPosition - 1] & 0xFF) << 8) + (payload[ - 2] & 0xFF); + return ((payload[currentPosition - 3] & 0xFF) << 24) + ((payload[currentPosition - 4] & 0xFF) << 16) + + ((payload[currentPosition - 1] & 0xFF) << 8) + (payload[-2] & 0xFF); } public int readUnsignedByte() { @@ -144,27 +138,28 @@ public int readUnsignedByte() { public int readShort2() { currentPosition += 2; int i = ((payload[currentPosition - 2] & 0xff) << 8) + (payload[currentPosition - 1] & 0xff); - if (i > 60000) - i = -65535 + i; + /** + * if (i > 60000) i = -65535 + i; + */ + if (i > 32767) + i -= 65537; return i; } - + public byte readSignedByte() { return payload[currentPosition++]; } public int readUShort() { currentPosition += 2; - return ((payload[currentPosition - 2] & 0xff) << 8) - + (payload[currentPosition - 1] & 0xff); + return ((payload[currentPosition - 2] & 0xff) << 8) + (payload[currentPosition - 1] & 0xff); } public int readShort() { currentPosition += 2; - int value = ((payload[currentPosition - 2] & 0xff) << 8) - + (payload[currentPosition - 1] & 0xff); - + int value = ((payload[currentPosition - 2] & 0xff) << 8) + (payload[currentPosition - 1] & 0xff); + if (value > 32767) { value -= 0x10000; } @@ -173,22 +168,19 @@ public int readShort() { public int readTriByte() { currentPosition += 3; - return ((payload[currentPosition - 3] & 0xff) << 16) - + ((payload[currentPosition - 2] & 0xff) << 8) + return ((payload[currentPosition - 3] & 0xff) << 16) + ((payload[currentPosition - 2] & 0xff) << 8) + (payload[currentPosition - 1] & 0xff); } public int readInt() { currentPosition += 4; - return ((payload[currentPosition - 4] & 0xff) << 24) - + ((payload[currentPosition - 3] & 0xff) << 16) - + ((payload[currentPosition - 2] & 0xff) << 8) - + (payload[currentPosition - 1] & 0xff); + return ((payload[currentPosition - 4] & 0xff) << 24) + ((payload[currentPosition - 3] & 0xff) << 16) + + ((payload[currentPosition - 2] & 0xff) << 8) + (payload[currentPosition - 1] & 0xff); } public long readLong() { - long msi = (long) readInt() & 0xffffffffL; - long lsi = (long) readInt() & 0xffffffffL; + long msi = readInt() & 0xffffffffL; + long lsi = readInt() & 0xffffffffL; return (msi << 32) + lsi; } @@ -223,19 +215,17 @@ public int readBits(int amount) { int value = 0; bitPosition += amount; for (; amount > bitOffset; bitOffset = 8) { - value += (payload[byteOffset++] & BIT_MASKS[bitOffset]) << amount - - bitOffset; + value += (payload[byteOffset++] & BIT_MASKS[bitOffset]) << amount - bitOffset; amount -= bitOffset; } if (amount == bitOffset) value += payload[byteOffset] & BIT_MASKS[bitOffset]; else - value += payload[byteOffset] >> bitOffset - amount - & BIT_MASKS[amount]; + value += payload[byteOffset] >> bitOffset - amount & BIT_MASKS[amount]; return value; } - public void disableBitAccess() { + public void disableBitAccess() { currentPosition = (bitPosition + 7) / 8; } @@ -264,8 +254,7 @@ public void encodeRSA(BigInteger exponent, BigInteger modulus) { byte rsa[] = buffer; if (Configuration.ENABLE_RSA) { - rsa = new BigInteger(buffer).modPow(exponent, modulus) - .toByteArray(); + rsa = new BigInteger(buffer).modPow(exponent, modulus).toByteArray(); } currentPosition = 0; @@ -318,27 +307,23 @@ public void writeLEShortA(int value) { public int readLEUShort() { currentPosition += 2; - return ((payload[currentPosition - 1] & 0xff) << 8) - + (payload[currentPosition - 2] & 0xff); + return ((payload[currentPosition - 1] & 0xff) << 8) + (payload[currentPosition - 2] & 0xff); } public int readUShortA() { currentPosition += 2; - return ((payload[currentPosition - 2] & 0xff) << 8) - + (payload[currentPosition - 1] - 128 & 0xff); + return ((payload[currentPosition - 2] & 0xff) << 8) + (payload[currentPosition - 1] - 128 & 0xff); } public int readLEUShortA() { currentPosition += 2; - return ((payload[currentPosition - 1] & 0xff) << 8) - + (payload[currentPosition - 2] - 128 & 0xff); + return ((payload[currentPosition - 1] & 0xff) << 8) + (payload[currentPosition - 2] - 128 & 0xff); } public int readLEShort() { currentPosition += 2; - int value = ((payload[currentPosition - 1] & 0xff) << 8) - + (payload[currentPosition - 2] & 0xff); - + int value = ((payload[currentPosition - 1] & 0xff) << 8) + (payload[currentPosition - 2] & 0xff); + if (value > 32767) { value -= 0x10000; } @@ -347,8 +332,7 @@ public int readLEShort() { public int readLEShortA() { currentPosition += 2; - int value = ((payload[currentPosition - 1] & 0xff) << 8) - + (payload[currentPosition - 2] - 128 & 0xff); + int value = ((payload[currentPosition - 1] & 0xff) << 8) + (payload[currentPosition - 2] - 128 & 0xff); if (value > 32767) value -= 0x10000; return value; @@ -356,18 +340,14 @@ public int readLEShortA() { public int readMEInt() { // V1 currentPosition += 4; - return ((payload[currentPosition - 2] & 0xff) << 24) - + ((payload[currentPosition - 1] & 0xff) << 16) - + ((payload[currentPosition - 4] & 0xff) << 8) - + (payload[currentPosition - 3] & 0xff); + return ((payload[currentPosition - 2] & 0xff) << 24) + ((payload[currentPosition - 1] & 0xff) << 16) + + ((payload[currentPosition - 4] & 0xff) << 8) + (payload[currentPosition - 3] & 0xff); } public int readIMEInt() { // V2 currentPosition += 4; - return ((payload[currentPosition - 3] & 0xff) << 24) - + ((payload[currentPosition - 4] & 0xff) << 16) - + ((payload[currentPosition - 1] & 0xff) << 8) - + (payload[currentPosition - 2] & 0xff); + return ((payload[currentPosition - 3] & 0xff) << 24) + ((payload[currentPosition - 4] & 0xff) << 16) + + ((payload[currentPosition - 1] & 0xff) << 8) + (payload[currentPosition - 2] & 0xff); } public void writeReverseDataA(byte data[], int length, int offset) { @@ -382,5 +362,5 @@ public void readReverseData(byte data[], int offset, int length) { } } - + } \ No newline at end of file diff --git a/Elvarg - Client/src/com/runescape/io/ByteBuffer.java b/Elvarg - Client/src/com/runescape/io/ByteBuffer.java index f8a46f0..d95bbf9 100644 --- a/Elvarg - Client/src/com/runescape/io/ByteBuffer.java +++ b/Elvarg - Client/src/com/runescape/io/ByteBuffer.java @@ -45,7 +45,9 @@ public void encryptRSAContent() { /* Reset the position */ position = reserve_packet_slots ? pkt_content_start : pkt_opcode_slot; - /* An empty byte array with a capacity of {@code #currentPosition} bytes */ + /* + * An empty byte array with a capacity of {@code #currentPosition} bytes + */ byte[] decodeBuffer = new byte[currentPosition]; /* @@ -143,12 +145,14 @@ public void getBytes(int len, int off, byte[] dest) { public int getInt() { position += 4; - return ((buffer[position - 4] & 0xFF) << 24) + ((buffer[position - 3] & 0xFF) << 16) + ((buffer[position - 2] & 0xFF) << 8) + (buffer[position - 1] & 0xFF); + return ((buffer[position - 4] & 0xFF) << 24) + ((buffer[position - 3] & 0xFF) << 16) + + ((buffer[position - 2] & 0xFF) << 8) + (buffer[position - 1] & 0xFF); } public int getIntLittleEndian() { position += 4; - return ((buffer[position - 4] & 0xFF) << 24) + ((buffer[position - 3] & 0xFF) << 16) + ((buffer[position - 2] & 0xFF) << 8) + (buffer[position - 1] & 0xFF); + return ((buffer[position - 4] & 0xFF) << 24) + ((buffer[position - 3] & 0xFF) << 16) + + ((buffer[position - 2] & 0xFF) << 8) + (buffer[position - 1] & 0xFF); } public long getLong() { @@ -228,7 +232,8 @@ public String getString() { public int getTribyte() { position += 3; - return ((buffer[position - 3] & 0xFF) << 16) + ((buffer[position - 2] & 0xFF) << 8) + (buffer[position - 1] & 0xFF); + return ((buffer[position - 3] & 0xFF) << 16) + ((buffer[position - 2] & 0xFF) << 8) + + (buffer[position - 1] & 0xFF); } public final int getTribyte(int value) { @@ -306,8 +311,7 @@ public int method427() { public int getByteA() { position += 2; - return ((buffer[position - 2] & 0xff) << 8) - + (buffer[position - 1] - 128 & 0xff); + return ((buffer[position - 2] & 0xff) << 8) + (buffer[position - 1] - 128 & 0xff); } public int method428() { @@ -362,12 +366,14 @@ public int method438() { public int method439() { position += 4; - return ((buffer[position - 2] & 0xFF) << 24) + ((buffer[position - 1] & 0xFF) << 16) + ((buffer[position - 4] & 0xFF) << 8) + (buffer[position - 3] & 0xFF); + return ((buffer[position - 2] & 0xFF) << 24) + ((buffer[position - 1] & 0xFF) << 16) + + ((buffer[position - 4] & 0xFF) << 8) + (buffer[position - 3] & 0xFF); } public int method440() { position += 4; - return ((buffer[position - 3] & 0xFF) << 24) + ((buffer[position - 4] & 0xFF) << 16) + ((buffer[position - 1] & 0xFF) << 8) + (buffer[position - 2] & 0xFF); + return ((buffer[position - 3] & 0xFF) << 24) + ((buffer[position - 4] & 0xFF) << 16) + + ((buffer[position - 1] & 0xFF) << 8) + (buffer[position - 2] & 0xFF); } public void method441(int i, byte abyte0[], int j) { @@ -458,7 +464,7 @@ public byte[] getBuffer() { public int bufferLength() { int size = position; - if(reserve_packet_slots) { + if (reserve_packet_slots) { /* Update the pkt_size slot and encrypt it */ buffer[pkt_size_slot] = (byte) (size + cipher.getNextKey()); } @@ -477,13 +483,12 @@ public ByteBuffer(byte[] buffer) { this.buffer = buffer; } - private static final int[] BIT_CONSTANTS = { 0, 1, 3, 7, 15, 31, 63, 127, - 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 0x1ffff, - 0x3ffff, 0x7ffff, 0xFFfff, 0x1fffff, 0x3fffff, 0x7fffff, 0xFFffff, - 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xFFfffff, 0x1fffffff, 0x3fffffff, - 0x7fffffff, -1 }; + private static final int[] BIT_CONSTANTS = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, + 32767, 65535, 0x1ffff, 0x3ffff, 0x7ffff, 0xFFfff, 0x1fffff, 0x3fffff, 0x7fffff, 0xFFffff, 0x1ffffff, + 0x3ffffff, 0x7ffffff, 0xFFfffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -1 }; - public static final BigInteger RSA_MODULUS = new BigInteger("104491769878744214552327916539299463496996457081116392641740420337580247359457531212713234798435269852381858199895582444770363103378419890508986198319599243102737368616946490728678876018327788000439596635223141886089230154991381365099178986572201859664528128354742213167942196819984139030533812106754541601427"); + public static final BigInteger RSA_MODULUS = new BigInteger( + "104491769878744214552327916539299463496996457081116392641740420337580247359457531212713234798435269852381858199895582444770363103378419890508986198319599243102737368616946490728678876018327788000439596635223141886089230154991381365099178986572201859664528128354742213167942196819984139030533812106754541601427"); public static final BigInteger RSA_EXPONENT = new BigInteger("65537"); } \ No newline at end of file diff --git a/Elvarg - Client/src/com/runescape/io/Jaggrab.java b/Elvarg - Client/src/com/runescape/io/Jaggrab.java index 2db4cc9..ac3544c 100644 --- a/Elvarg - Client/src/com/runescape/io/Jaggrab.java +++ b/Elvarg - Client/src/com/runescape/io/Jaggrab.java @@ -15,27 +15,22 @@ import com.runescape.sign.SignLink; /** - * A class representing the Jaggrab - * update-server system for a 317 client. + * A class representing the Jaggrab update-server system for a 317 client. * - * This system also supports preloadable - * files, basically files which haven't + * This system also supports preloadable files, basically files which haven't * been packed into the main cache files. * * @author Professor Oak */ public class Jaggrab { + // Files that will always be updated & downloaded from the update-server + // NOTE: These exact files must be defined in the update-server's + // PRELOAD_FILES + // array aswell to prevent CRC-checking issues. + private static final String[] PRELOAD_FILES = { "sprites.idx", "sprites.dat", "obj.idx", "obj.dat" }; - //Files that will always be updated & downloaded from the update-server - //NOTE: These exact files must be defined in the update-server's PRELOAD_FILES - //array aswell to prevent CRC-checking issues. - private static final String[] PRELOAD_FILES = { - "sprites.idx", "sprites.dat", - "obj.idx", "obj.dat" - }; - - //Archive CRCs + // Archive CRCs public static final int TITLE_CRC = 1; public static final int CONFIG_CRC = 2; public static final int INTERFACE_CRC = 3; @@ -45,34 +40,32 @@ public class Jaggrab { public static final int CHAT_CRC = 7; public static final int SOUNDS_CRC = 8; - //CRCs + // CRCs public static final int TOTAL_ARCHIVE_CRCS = 9; public static final int[] CRCs = new int[TOTAL_ARCHIVE_CRCS + PRELOAD_FILES.length]; - /** - * Requests the crc table from the update-server - * and puts them into our array for future - * use. + * Requests the crc table from the update-server and puts them into our + * array for future use. * - * Crcs are used for checking if files are - * up to date, and for other things aswell. + * Crcs are used for checking if files are up to date, and for other things + * aswell. */ public static void requestCrcs() { int delay = 5; int failedAttempts = 0; - while(!crcsLoaded()) { + while (!crcsLoaded()) { try (DataInputStream in = openRequest("crc" + (int) (Math.random() * 99999999D) + "-" + 317)) { Client.instance.drawLoadingText(20, "Requesting CRCs.."); - - //Get incoming data + + // Get incoming data Buffer buffer = new Buffer(readFile(in)); for (int index = 0; index < CRCs.length; index++) { CRCs[index] = buffer.readInt(); } - + int expected = buffer.readInt(); int calculated = 1234; for (int index = 0; index < CRCs.length; index++) { @@ -80,7 +73,7 @@ public static void requestCrcs() { } if (expected != calculated) { - //Check sum error + // Check sum error resetCrcs(); } @@ -89,7 +82,7 @@ public static void requestCrcs() { resetCrcs(); } - //Didn't load properly + // Didn't load properly if (!crcsLoaded()) { failedAttempts++; for (int remaining = delay; remaining > 0; remaining--) { @@ -109,11 +102,12 @@ public static void requestCrcs() { if (delay > 60) { delay = 60; } - + failedAttempts = 0; delay = 4; - //Configuration.JAGCACHED_ENABLED = !Configuration.JAGCACHED_ENABLED; + // Configuration.JAGCACHED_ENABLED = + // !Configuration.JAGCACHED_ENABLED; } } } @@ -122,20 +116,21 @@ public static void requestCrcs() { * Preloads all our files. */ public static void preload() { - for(int i = 0; i < PRELOAD_FILES.length; i++) { + for (int i = 0; i < PRELOAD_FILES.length; i++) { preload(i, PRELOAD_FILES[i]); } } /** - * Preloads a file from the update-server - * if we dont have it or it's outdated (compares CRC). + * Preloads a file from the update-server if we dont have it or it's + * outdated (compares CRC). * - * Sends a request to the server and starts - * downloading the file. + * Sends a request to the server and starts downloading the file. * - * @param i The index of the preload file - * @param fileName The name of the file to be preloaded + * @param i + * The index of the preload file + * @param fileName + * The name of the file to be preloaded */ private static void preload(int i, String fileName) { int failedAttempts = 0; @@ -143,40 +138,40 @@ private static void preload(int i, String fileName) { boolean exists = false; byte[] buffer = null; - //Check if file already exists... + // Check if file already exists... File file = new File(SignLink.findcachedir() + fileName); - if(file.exists() && !file.isDirectory()) { + if (file.exists() && !file.isDirectory()) { exists = true; buffer = FileUtils.readFile(SignLink.findcachedir() + fileName); } - - //Check if the file is "updated" by comparing crc.. - if(buffer != null) { + + // Check if the file is "updated" by comparing crc.. + if (buffer != null) { if (!compareCrc(buffer, CRCs[TOTAL_ARCHIVE_CRCS + i])) { buffer = null; } } - //We already had the updated file! - if(buffer != null) { + // We already had the updated file! + if (buffer != null) { return; } - //Let's download the file. - while(buffer == null) { + // Let's download the file. + while (buffer == null) { Client.instance.drawLoadingText(20, "Requesting " + fileName); try { - //Try to get the file.. + // Try to get the file.. buffer = readFile(openRequest("preload/" + fileName)); - - //Compare crc again... + + // Compare crc again... if (!compareCrc(buffer, CRCs[TOTAL_ARCHIVE_CRCS + i])) { buffer = null; } - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } @@ -199,16 +194,17 @@ private static void preload(int i, String fileName) { if (delay > 60) { delay = 60; } - + delay = 4; failedAttempts = 0; - - //Configuration.JAGCACHED_ENABLED = !Configuration.JAGCACHED_ENABLED; + + // Configuration.JAGCACHED_ENABLED = + // !Configuration.JAGCACHED_ENABLED; } } - - //Write the downloaded file.. - if(buffer != null && !exists) { + + // Write the downloaded file.. + if (buffer != null && !exists) { try { FileUtils.writeFile(buffer, file.getAbsolutePath()); } catch (IOException e) { @@ -217,9 +213,9 @@ private static void preload(int i, String fileName) { } } - /** * Sends a request to the update-server + * * @param request * @return * @throws IOException @@ -248,32 +244,32 @@ public static DataInputStream openRequest(String request) throws IOException { /** * Gets the current buffer from the update-server + * * @param in * @return * @throws IOException */ public static byte[] readFile(DataInputStream in) throws IOException { - - //Read incoming file size.. + + // Read incoming file size.. int size = in.readInt(); - if(size <= 0) { + if (size <= 0) { return null; } - - //Read incoming file.. + + // Read incoming file.. ByteArrayOutputStream buffer = new ByteArrayOutputStream(); byte[] data = new byte[size]; int read; while ((read = in.read(data)) != -1) { - buffer.write(data, 0, read); + buffer.write(data, 0, read); } - + return buffer.toByteArray(); } /** - * Compares crcs to check if a file's buffer is - * up to date or not. + * Compares crcs to check if a file's buffer is up to date or not. * * @param buffer * @param expectedCrc @@ -282,17 +278,18 @@ public static byte[] readFile(DataInputStream in) throws IOException { private static boolean compareCrc(byte[] buffer, int expectedCrc) { Client.instance.indexCrc.reset(); Client.instance.indexCrc.update(buffer); - int crc = (int) Client.instance.indexCrc.getValue(); + int crc = (int) Client.instance.indexCrc.getValue(); return crc == expectedCrc; } /** * Checks if we have succesfully loaded all our crcs. + * * @return */ private static boolean crcsLoaded() { - for(int i = 0; i < CRCs.length; i++) { - if(CRCs[i] == -1) { + for (int i = 0; i < CRCs.length; i++) { + if (CRCs[i] == -1) { return false; } } @@ -303,7 +300,7 @@ private static boolean crcsLoaded() { * Resets the crc table */ private static void resetCrcs() { - for(int i = 0; i < CRCs.length; i++) { + for (int i = 0; i < CRCs.length; i++) { CRCs[i] = -1; } } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/OutgoingPacket.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/OutgoingPacket.java index 6f3e064..af4d2e6 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/OutgoingPacket.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/OutgoingPacket.java @@ -5,5 +5,5 @@ public interface OutgoingPacket { public void buildPacket(ByteBuffer buf); - + } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AddFriend.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AddFriend.java index 42a3126..9d76033 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AddFriend.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AddFriend.java @@ -6,15 +6,15 @@ public class AddFriend implements OutgoingPacket { private long friend; + public AddFriend(long friend) { this.friend = friend; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(188); buf.putLong(friend); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AddIgnore.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AddIgnore.java index 9f9d809..b3fdf6d 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AddIgnore.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AddIgnore.java @@ -6,15 +6,15 @@ public class AddIgnore implements OutgoingPacket { private long friend; + public AddIgnore(long ignore) { this.friend = ignore; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(133); buf.putLong(friend); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AttackNpc.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AttackNpc.java index abcef75..7231070 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AttackNpc.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/AttackNpc.java @@ -6,11 +6,11 @@ public class AttackNpc implements OutgoingPacket { int nodeId; - + public AttackNpc(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(72); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/BankTabCreation.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/BankTabCreation.java index 8052112..3cb4d7d 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/BankTabCreation.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/BankTabCreation.java @@ -6,15 +6,15 @@ public class BankTabCreation implements OutgoingPacket { int interface_; - int dragFromSlot; + int dragFromSlot; int toInterface_; - + public BankTabCreation(int interface_, int dragFromSlot, int toInterface_) { this.interface_ = interface_; this.dragFromSlot = dragFromSlot; this.toInterface_ = toInterface_; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(216); @@ -23,5 +23,4 @@ public void buildPacket(ByteBuffer buf) { buf.writeUnsignedWordBigEndian(toInterface_); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/BasicPing.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/BasicPing.java index f89a829..ccd944c 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/BasicPing.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/BasicPing.java @@ -10,5 +10,4 @@ public void buildPacket(ByteBuffer buf) { buf.putOpcode(0); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ChangeAppearance.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ChangeAppearance.java index a7854a8..3daf7c0 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ChangeAppearance.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ChangeAppearance.java @@ -5,10 +5,10 @@ public class ChangeAppearance implements OutgoingPacket { - boolean isMale; + boolean isMale; int[] myAppearance; int[] characterDesignColours; - + public ChangeAppearance(boolean isMale, int[] myAppearance, int[] characterDesignColours) { this.isMale = isMale; this.myAppearance = myAppearance; diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/Chat.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/Chat.java index 60e5613..0182c0b 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/Chat.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/Chat.java @@ -3,17 +3,18 @@ import com.runescape.io.ByteBuffer; import com.runescape.io.packets.outgoing.OutgoingPacket; -public class Chat implements OutgoingPacket{ +public class Chat implements OutgoingPacket { private int color; private int effect; private String say; + public Chat(int color, int effect, String say) { this.color = color; this.effect = effect; this.say = say; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(4); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ChatSettings.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ChatSettings.java index d43e9cc..ad9e7f5 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ChatSettings.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ChatSettings.java @@ -4,17 +4,17 @@ import com.runescape.io.packets.outgoing.OutgoingPacket; public class ChatSettings implements OutgoingPacket { - - int publicMode; + + int publicMode; int privateMode; int tradeMode; - + public ChatSettings(int publicMode, int privateMode, int tradeMode) { this.publicMode = publicMode; this.privateMode = privateMode; this.tradeMode = tradeMode; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(95); @@ -23,5 +23,4 @@ public void buildPacket(ByteBuffer buf) { buf.putByte(tradeMode); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClearMinimapFlag.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClearMinimapFlag.java index e672638..c3a5ea8 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClearMinimapFlag.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClearMinimapFlag.java @@ -10,5 +10,4 @@ public void buildPacket(ByteBuffer buf) { buf.putOpcode(78); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClickButton.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClickButton.java index 8e99202..426f6e4 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClickButton.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClickButton.java @@ -6,11 +6,11 @@ public class ClickButton implements OutgoingPacket { private int buttonId; - + public ClickButton(int button) { this.buttonId = button; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(185); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClickButtonAction.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClickButtonAction.java index 574d3dc..b3e595f 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClickButtonAction.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClickButtonAction.java @@ -6,12 +6,12 @@ public class ClickButtonAction implements OutgoingPacket { private int buttonId, action; - + public ClickButtonAction(int button, int action) { this.buttonId = button; this.action = action; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(186); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClientFocused.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClientFocused.java index 71dbc04..3af2605 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClientFocused.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ClientFocused.java @@ -6,15 +6,15 @@ public class ClientFocused implements OutgoingPacket { private boolean focused; + public ClientFocused(boolean focused) { this.focused = focused; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(3); buf.putByte(focused ? 1 : 0); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/Command.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/Command.java index f151bff..b0f2c4d 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/Command.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/Command.java @@ -6,15 +6,15 @@ public class Command implements OutgoingPacket { private String cmd; + public Command(String cmd) { this.cmd = cmd; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(103); buf.putString(cmd); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DeleteFriend.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DeleteFriend.java index faf28a1..7d6f1df 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DeleteFriend.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DeleteFriend.java @@ -6,15 +6,15 @@ public class DeleteFriend implements OutgoingPacket { private long friend; + public DeleteFriend(long friend) { this.friend = friend; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(215); buf.putLong(friend); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DeleteIgnore.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DeleteIgnore.java index a5c860a..60fd46e 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DeleteIgnore.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DeleteIgnore.java @@ -6,15 +6,15 @@ public class DeleteIgnore implements OutgoingPacket { private long ignore; + public DeleteIgnore(long ignore) { this.ignore = ignore; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(74); buf.putLong(ignore); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DropItem.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DropItem.java index 5f612dc..6820c6f 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DropItem.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/DropItem.java @@ -8,13 +8,13 @@ public class DropItem implements OutgoingPacket { int nodeId; int interfaceId; int slot; - + public DropItem(int nodeId, int interfaceId, int slot) { this.nodeId = nodeId; this.interfaceId = interfaceId; this.slot = slot; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(87); @@ -23,5 +23,4 @@ public void buildPacket(ByteBuffer buf) { buf.writeUnsignedWordA(slot); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/EnterAmount.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/EnterAmount.java index 0ea5dc0..9f04ea0 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/EnterAmount.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/EnterAmount.java @@ -6,10 +6,11 @@ public class EnterAmount implements OutgoingPacket { private int amount; + public EnterAmount(int amount) { this.amount = amount; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(208); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ExamineItem.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ExamineItem.java index d694a0b..1aeafef 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ExamineItem.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ExamineItem.java @@ -6,11 +6,11 @@ public class ExamineItem implements OutgoingPacket { int nodeId; - + public ExamineItem(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(2); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ExamineNpc.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ExamineNpc.java index 03b143c..fc35806 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ExamineNpc.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ExamineNpc.java @@ -6,11 +6,11 @@ public class ExamineNpc implements OutgoingPacket { int nodeId; - + public ExamineNpc(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(6); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/FinalizedRegionChange.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/FinalizedRegionChange.java index 02f0c12..6c7b68f 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/FinalizedRegionChange.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/FinalizedRegionChange.java @@ -10,5 +10,4 @@ public void buildPacket(ByteBuffer buf) { buf.putOpcode(121); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemContainerOption4.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemContainerOption4.java index 2b13771..40c0d3f 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemContainerOption4.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemContainerOption4.java @@ -8,13 +8,13 @@ public class ItemContainerOption4 implements OutgoingPacket { int slot; int interfaceId; int nodeId; - + public ItemContainerOption4(int slot, int interfaceId, int nodeId) { this.nodeId = nodeId; this.slot = slot; this.interfaceId = interfaceId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(129); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemContainerOption5.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemContainerOption5.java index c102b99..ae943fe 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemContainerOption5.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemContainerOption5.java @@ -8,13 +8,13 @@ public class ItemContainerOption5 implements OutgoingPacket { int slot; int interfaceId; int nodeId; - + public ItemContainerOption5(int slot, int interfaceId, int nodeId) { this.nodeId = nodeId; this.slot = slot; this.interfaceId = interfaceId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(135); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnGroundItem.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnGroundItem.java index 945742a..a52bbe7 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnGroundItem.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnGroundItem.java @@ -11,7 +11,7 @@ public class ItemOnGroundItem implements OutgoingPacket { int nodeId; int val1; int val2; - + public ItemOnGroundItem(int anInt1284, int anInt1285, int nodeId, int val1, int anInt1283, int val2) { this.nodeId = nodeId; this.val1 = val1; @@ -20,7 +20,7 @@ public ItemOnGroundItem(int anInt1284, int anInt1285, int nodeId, int val1, int this.anInt1284 = anInt1284; this.anInt1285 = anInt1285; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(109); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnItem.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnItem.java index 6cce031..7324903 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnItem.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnItem.java @@ -12,7 +12,6 @@ public class ItemOnItem implements OutgoingPacket { int anInt1283; int anInt1284; - public ItemOnItem(int slot, int anInt1283, int nodeId, int anInt1284, int anInt1285, int interfaceId) { this.nodeId = nodeId; this.slot = slot; @@ -21,7 +20,7 @@ public ItemOnItem(int slot, int anInt1283, int nodeId, int anInt1284, int anInt1 this.anInt1284 = anInt1284; this.anInt1285 = anInt1285; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(53); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnNpc.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnNpc.java index c5d8647..46698bc 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnNpc.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnNpc.java @@ -9,14 +9,14 @@ public class ItemOnNpc implements OutgoingPacket { int nodeId; int anInt1283; int anInt1284; - + public ItemOnNpc(int anInt1285, int nodeId, int anInt1283, int anInt1284) { this.anInt1285 = anInt1285; this.nodeId = nodeId; this.anInt1283 = anInt1283; this.anInt1284 = anInt1284; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(57); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnObject.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnObject.java index f5f1d9f..8ac34b6 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnObject.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnObject.java @@ -11,6 +11,7 @@ public class ItemOnObject implements OutgoingPacket { int id; int val1; int val2; + public ItemOnObject(int anInt1284, int id, int val1, int anInt1283, int val2, int anInt1285) { this.id = id; this.val1 = val1; @@ -19,7 +20,7 @@ public ItemOnObject(int anInt1284, int id, int val1, int anInt1283, int val2, in this.anInt1284 = anInt1284; this.anInt1285 = anInt1285; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(192); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnPlayer.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnPlayer.java index ded6114..3528954 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnPlayer.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ItemOnPlayer.java @@ -9,14 +9,14 @@ public class ItemOnPlayer implements OutgoingPacket { int nodeId; int anInt1283; int anInt1284; - + public ItemOnPlayer(int anInt1284, int nodeId, int anInt1285, int anInt1283) { this.anInt1285 = anInt1285; this.nodeId = nodeId; this.anInt1283 = anInt1283; this.anInt1284 = anInt1284; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(14); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnGroundItem.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnGroundItem.java index 5c0de5f..67a64f0 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnGroundItem.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnGroundItem.java @@ -9,14 +9,14 @@ public class MagicOnGroundItem implements OutgoingPacket { int nodeId; int val2; int selectedSpellId; - + public MagicOnGroundItem(int val1, int nodeId, int val2, int selectedSpellId) { this.val1 = val1; this.nodeId = nodeId; this.val2 = val2; this.selectedSpellId = selectedSpellId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(181); @@ -26,5 +26,4 @@ public void buildPacket(ByteBuffer buf) { buf.writeUnsignedWordA(selectedSpellId); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnItem.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnItem.java index 03b3275..34b2a8f 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnItem.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnItem.java @@ -9,14 +9,14 @@ public class MagicOnItem implements OutgoingPacket { int nodeId; int interfaceId; int selectedSpellId; - + public MagicOnItem(int slot, int nodeId, int interfaceId, int selectedSpellId) { this.slot = slot; this.nodeId = nodeId; this.interfaceId = interfaceId; this.selectedSpellId = selectedSpellId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(237); @@ -26,5 +26,4 @@ public void buildPacket(ByteBuffer buf) { buf.writeUnsignedWordA(selectedSpellId); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnNpc.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnNpc.java index ecc602a..3f2460f 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnNpc.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnNpc.java @@ -7,12 +7,12 @@ public class MagicOnNpc implements OutgoingPacket { int nodeId; int selectedSpellId; - + public MagicOnNpc(int nodeId, int selectedSpellId) { this.nodeId = nodeId; this.selectedSpellId = selectedSpellId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(131); @@ -20,5 +20,4 @@ public void buildPacket(ByteBuffer buf) { buf.writeUnsignedWordA(selectedSpellId); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnPlayer.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnPlayer.java index 37b6653..85554db 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnPlayer.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/MagicOnPlayer.java @@ -7,12 +7,12 @@ public class MagicOnPlayer implements OutgoingPacket { int nodeId; int selectedSpellId; - + public MagicOnPlayer(int nodeId, int selectedSpellId) { this.nodeId = nodeId; this.selectedSpellId = selectedSpellId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(249); @@ -20,5 +20,4 @@ public void buildPacket(ByteBuffer buf) { buf.writeUnsignedWordBigEndian(selectedSpellId); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NextDialogue.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NextDialogue.java index e80b7cd..cf7dcba 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NextDialogue.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NextDialogue.java @@ -6,16 +6,15 @@ public class NextDialogue implements OutgoingPacket { int interfaceId; - + public NextDialogue(int interfaceId) { this.interfaceId = interfaceId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(40); buf.putShort(interfaceId); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption1.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption1.java index 7c28349..8c5c188 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption1.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption1.java @@ -6,11 +6,11 @@ public class NpcOption1 implements OutgoingPacket { int nodeId; - + public NpcOption1(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(155); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption2.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption2.java index 94cbca5..690d80e 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption2.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption2.java @@ -6,11 +6,11 @@ public class NpcOption2 implements OutgoingPacket { int nodeId; - + public NpcOption2(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(17); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption3.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption3.java index acca7d7..d5f243b 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption3.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption3.java @@ -6,11 +6,11 @@ public class NpcOption3 implements OutgoingPacket { int nodeId; - + public NpcOption3(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(21); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption4.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption4.java index 09df977..459ad6b 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption4.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/NpcOption4.java @@ -6,11 +6,11 @@ public class NpcOption4 implements OutgoingPacket { int nodeId; - + public NpcOption4(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(18); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption1.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption1.java index d32ec7b..3ab4373 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption1.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption1.java @@ -8,12 +8,13 @@ public class ObjectOption1 implements OutgoingPacket { int id; int val1; int val2; + public ObjectOption1(int val1, int id, int val2) { this.id = id; this.val1 = val1; this.val2 = val2; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(132); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption2.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption2.java index f3f9f4d..300aab5 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption2.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption2.java @@ -8,12 +8,13 @@ public class ObjectOption2 implements OutgoingPacket { int id; int val1; int val2; + public ObjectOption2(int id, int val1, int val2) { this.id = id; this.val1 = val1; this.val2 = val2; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(252); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption3.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption3.java index 6938edd..5cdd026 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption3.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption3.java @@ -8,12 +8,13 @@ public class ObjectOption3 implements OutgoingPacket { int id; int val1; int val2; + public ObjectOption3(int val1, int val2, int id) { this.id = id; this.val1 = val1; this.val2 = val2; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(70); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption4.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption4.java index 2808639..fb1d348 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption4.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption4.java @@ -8,12 +8,13 @@ public class ObjectOption4 implements OutgoingPacket { int id; int val1; int val2; + public ObjectOption4(int val1, int id, int val2) { this.id = id; this.val1 = val1; this.val2 = val2; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(234); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption5.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption5.java index e43a939..8652c8b 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption5.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/ObjectOption5.java @@ -8,12 +8,13 @@ public class ObjectOption5 implements OutgoingPacket { int id; int val1; int val2; + public ObjectOption5(int id, int val1, int val2) { this.id = id; this.val1 = val1; this.val2 = val2; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(228); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PickupItem.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PickupItem.java index b2481c4..48be636 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PickupItem.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PickupItem.java @@ -8,13 +8,13 @@ public class PickupItem implements OutgoingPacket { int nodeId; int val1; int val2; - + public PickupItem(int val1, int nodeId, int val2) { this.val1 = val1; this.nodeId = nodeId; this.val2 = val2; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(236); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerAttackOption.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerAttackOption.java index c812c57..7666246 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerAttackOption.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerAttackOption.java @@ -6,11 +6,11 @@ public class PlayerAttackOption implements OutgoingPacket { int nodeId; - + public PlayerAttackOption(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(153); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerInactive.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerInactive.java index 7ce6ecd..d33d5ac 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerInactive.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerInactive.java @@ -5,12 +5,10 @@ public class PlayerInactive implements OutgoingPacket { - @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(202); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerOption1.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerOption1.java index 5b315c2..d2663a2 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerOption1.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PlayerOption1.java @@ -6,11 +6,11 @@ public class PlayerOption1 implements OutgoingPacket { int nodeId; - + public PlayerOption1(int nodeId) { this.nodeId = nodeId; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(128); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PrivateMessage.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PrivateMessage.java index f31a892..07e296d 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PrivateMessage.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/PrivateMessage.java @@ -7,11 +7,12 @@ public class PrivateMessage implements OutgoingPacket { private long friend; private String msg; + public PrivateMessage(long friend, String msg) { this.friend = friend; this.msg = msg; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(126); @@ -19,5 +20,4 @@ public void buildPacket(ByteBuffer buf) { buf.putString(msg); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/RegionChange.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/RegionChange.java index daf6ade..ec8ea95 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/RegionChange.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/RegionChange.java @@ -10,5 +10,5 @@ public void buildPacket(ByteBuffer buf) { buf.putOpcode(210); buf.putInt(0x3f008edd); } - + } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/SendSyntax.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/SendSyntax.java index 36def7d..2e33245 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/SendSyntax.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/SendSyntax.java @@ -6,15 +6,15 @@ public class SendSyntax implements OutgoingPacket { private String chat; + public SendSyntax(String chat) { this.chat = chat; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(60); buf.putString(chat); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/SwitchItemSlot.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/SwitchItemSlot.java index be371c1..cc53d66 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/SwitchItemSlot.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/SwitchItemSlot.java @@ -7,16 +7,16 @@ public class SwitchItemSlot implements OutgoingPacket { int interface_; int param2; - int dragFromSlot; + int dragFromSlot; int toInterface_; - + public SwitchItemSlot(int interface_, int param2, int dragFromSlot, int toInterface_) { this.interface_ = interface_; this.param2 = param2; this.dragFromSlot = dragFromSlot; this.toInterface_ = toInterface_; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(214); @@ -26,5 +26,4 @@ public void buildPacket(ByteBuffer buf) { buf.writeUnsignedWordBigEndian(toInterface_); } - } diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/UpdatePlane.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/UpdatePlane.java index f357db6..9c734f4 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/UpdatePlane.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/UpdatePlane.java @@ -8,9 +8,9 @@ public class UpdatePlane implements OutgoingPacket { int plane; public UpdatePlane(int plane) { - this.plane = plane; + this.plane = plane; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(229); diff --git a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/UseItem.java b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/UseItem.java index ec177f4..89b1cc2 100644 --- a/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/UseItem.java +++ b/Elvarg - Client/src/com/runescape/io/packets/outgoing/impl/UseItem.java @@ -8,13 +8,13 @@ public class UseItem implements OutgoingPacket { int interfaceId; int slot; int nodeId; - + public UseItem(int interfaceId, int slot, int nodeId) { this.nodeId = nodeId; this.interfaceId = interfaceId; this.slot = slot; } - + @Override public void buildPacket(ByteBuffer buf) { buf.putOpcode(122); diff --git a/Elvarg - Client/src/com/runescape/model/EffectTimer.java b/Elvarg - Client/src/com/runescape/model/EffectTimer.java index 81485d8..15d3ad4 100644 --- a/Elvarg - Client/src/com/runescape/model/EffectTimer.java +++ b/Elvarg - Client/src/com/runescape/model/EffectTimer.java @@ -8,14 +8,15 @@ public EffectTimer(int timer, int sprite) { this.timer = timer; this.sprite = sprite; } - + private int sprite; private int timer; private Stopwatch decrement_timer = new Stopwatch().reset(); - + public int getSprite() { return sprite; } + public void setSprite(int sprite) { this.sprite = sprite; } @@ -23,19 +24,19 @@ public void setSprite(int sprite) { public int getTimer() { return timer; } - + public void setTimer(int timer) { this.timer = timer; } - + public int decrementAndGetTimer() { - - //Decrement each second - if(decrement_timer.elapsed(1000)) { + + // Decrement each second + if (decrement_timer.elapsed(1000)) { decrement_timer.reset(); return this.timer--; } - + return timer; } } diff --git a/Elvarg - Client/src/com/runescape/model/GameItem.java b/Elvarg - Client/src/com/runescape/model/GameItem.java index 2239e2e..9be31b7 100644 --- a/Elvarg - Client/src/com/runescape/model/GameItem.java +++ b/Elvarg - Client/src/com/runescape/model/GameItem.java @@ -6,14 +6,14 @@ public GameItem(int item, int amount) { this.item = item; this.amount = amount; } - + int item; int amount; public int getItem() { return item; } - + public int getAmount() { return amount; } diff --git a/Elvarg - Client/src/com/runescape/net/BufferedConnection.java b/Elvarg - Client/src/com/runescape/net/BufferedConnection.java index 8e9b5f4..fe61f84 100644 --- a/Elvarg - Client/src/com/runescape/net/BufferedConnection.java +++ b/Elvarg - Client/src/com/runescape/net/BufferedConnection.java @@ -1,14 +1,15 @@ package com.runescape.net; -import java.io.*; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.net.Socket; import com.runescape.GameApplet; public final class BufferedConnection implements Runnable { - public BufferedConnection(GameApplet RSApplet_, Socket socket1) - throws IOException { + public BufferedConnection(GameApplet RSApplet_, Socket socket1) throws IOException { closed = false; isWriter = false; hasIOError = false; @@ -30,7 +31,7 @@ public void close() { if (socket != null) socket.close(); } catch (IOException _ex) { - //System.out.println("Error closing stream"); + // System.out.println("Error closing stream"); } isWriter = false; synchronized (this) { @@ -72,7 +73,7 @@ public void queueBytes(int i, byte abyte0[]) throws IOException { return; if (hasIOError) { hasIOError = false; - //throw new IOException("Error in writer thread"); + // throw new IOException("Error in writer thread"); } if (buffer == null) buffer = new byte[5000]; @@ -92,6 +93,7 @@ public void queueBytes(int i, byte abyte0[]) throws IOException { } } + @Override public void run() { while (isWriter) { int i; diff --git a/Elvarg - Client/src/com/runescape/net/requester/Provider.java b/Elvarg - Client/src/com/runescape/net/requester/Provider.java index 2121a14..9b335c5 100644 --- a/Elvarg - Client/src/com/runescape/net/requester/Provider.java +++ b/Elvarg - Client/src/com/runescape/net/requester/Provider.java @@ -2,5 +2,5 @@ public abstract class Provider { - public abstract void provide(int file); + public abstract void provide(int file); } diff --git a/Elvarg - Client/src/com/runescape/net/requester/Resource.java b/Elvarg - Client/src/com/runescape/net/requester/Resource.java index 34545ee..8d34086 100644 --- a/Elvarg - Client/src/com/runescape/net/requester/Resource.java +++ b/Elvarg - Client/src/com/runescape/net/requester/Resource.java @@ -3,7 +3,7 @@ import com.runescape.collection.Cacheable; public final class Resource extends Cacheable { - + public int dataType; public byte buffer[]; public int ID; diff --git a/Elvarg - Client/src/com/runescape/net/requester/ResourceProvider.java b/Elvarg - Client/src/com/runescape/net/requester/ResourceProvider.java index 57cce6b..70163e7 100644 --- a/Elvarg - Client/src/com/runescape/net/requester/ResourceProvider.java +++ b/Elvarg - Client/src/com/runescape/net/requester/ResourceProvider.java @@ -1,7 +1,12 @@ package com.runescape.net.requester; -import java.io.*; + +import java.io.ByteArrayInputStream; +import java.io.DataOutputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.net.Socket; -import java.util.stream.Stream; import java.util.zip.CRC32; import java.util.zip.GZIPInputStream; @@ -13,9 +18,6 @@ import com.runescape.io.Buffer; import com.runescape.sign.SignLink; -import jdk.nashorn.internal.runtime.regexp.joni.Config; -import sun.security.krb5.internal.crypto.crc32; - public final class ResourceProvider extends Provider implements Runnable { private int totalFiles; @@ -83,10 +85,12 @@ private void respond() { ; int type = payload[0] & 0xff; int file = ((payload[1] & 0xff) << 16) + ((payload[2] & 0xff) << 8) + (payload[3] & 0xff); - int length = ((payload[4] & 0xff) << 32) + ((payload[5] & 0xff) << 16) + ((payload[6] & 0xff) << 8) + (payload[7] & 0xff); + int length = ((payload[4] & 0xff) << 32) + ((payload[5] & 0xff) << 16) + ((payload[6] & 0xff) << 8) + + (payload[7] & 0xff); int sector = ((payload[8] & 0xff) << 8) + (payload[9] & 0xff); current = null; - for (Resource resource = (Resource) requested.reverseGetFirst(); resource != null; resource = (Resource) requested.reverseGetNext()) { + for (Resource resource = (Resource) requested + .reverseGetFirst(); resource != null; resource = (Resource) requested.reverseGetNext()) { if (resource.dataType == type && resource.ID == file) current = resource; if (current != null) @@ -101,9 +105,10 @@ private void respond() { if (current.incomplete) synchronized (complete) { complete.insertHead(current); - } else { - current.unlink(); } + else { + current.unlink(); + } current = null; } else { if (current.buffer == null && sector == 0) @@ -125,9 +130,11 @@ private void respond() { data = current.buffer; read = completedSize; } - for (int skip = 0; skip < remainingData; skip += inputStream.read(data, skip + read, remainingData - skip)); + for (int skip = 0; skip < remainingData; skip += inputStream.read(data, skip + read, + remainingData - skip)) + ; if (remainingData + completedSize >= data.length && current != null) { - //if (clientInstance.indices[0] != null) + // if (clientInstance.indices[0] != null) clientInstance.indices[current.dataType + 1].writeFile(data.length, data, current.ID); if (!current.incomplete && current.dataType == 3) { current.incomplete = true; @@ -136,9 +143,10 @@ private void respond() { if (current.incomplete) synchronized (complete) { complete.insertHead(current); - } else { - current.unlink(); } + else { + current.unlink(); + } } remainingData = 0; } @@ -157,31 +165,29 @@ private void respond() { public int mapAmount = 0; - private final String crcNames[] = {"model_crc", "anim_crc", "midi_crc", "map_crc"}; + private final String crcNames[] = { "model_crc", "anim_crc", "midi_crc", "map_crc" }; private final int[][] crcs = new int[crcNames.length][]; public void initialize(FileArchive archive, Client client) { - for(int i = 0; i < crcNames.length; i++) { + for (int i = 0; i < crcNames.length; i++) { byte[] crc_file = archive.readFile(crcNames[i]); int length = 0; - if(crc_file != null) { + if (crc_file != null) { length = crc_file.length / 4; Buffer crcStream = new Buffer(crc_file); crcs[i] = new int[length]; fileStatus[i] = new byte[length]; - for(int ptr = 0; ptr < length; ptr++) { + for (int ptr = 0; ptr < length; ptr++) { crcs[i][ptr] = crcStream.readInt(); } - } + } } - - byte[] mapData = archive.readFile("map_index"); Buffer stream2 = new Buffer(mapData); - int j1 = stream2.readUShort();//mapData.length / 6; + int j1 = stream2.readUShort();// mapData.length / 6; areas = new int[j1]; mapFiles = new int[j1]; landscapes = new int[j1]; @@ -248,34 +254,30 @@ private void request(Resource resource) { idleTime = 0; } - - //Send data type + // Send data type payload[0] = (byte) resource.dataType; - //Send file id as int + // Send file id as int payload[1] = (byte) (resource.ID >> 24); payload[2] = (byte) (resource.ID >> 16); payload[3] = (byte) (resource.ID >> 8); payload[4] = (byte) resource.ID; - //Send priority - /*if (resource.incomplete) - payload[5] = 2; - else if (!Client.loggedIn) - payload[5] = 1; - else - payload[5] = 0;*/ - + // Send priority + /* + * if (resource.incomplete) payload[5] = 2; else if + * (!Client.loggedIn) payload[5] = 1; else payload[5] = 0; + */ - //Priority 1 = HIGH, 2 = MEDIUM , 3 = LOW - if(!resource.incomplete) - payload[5] = 1; //HIGH PRIORITY - else - payload[5] = 2; //MEDIUM PRIORITY + // Priority 1 = HIGH, 2 = MEDIUM , 3 = LOW + if (!resource.incomplete) + payload[5] = 1; // HIGH PRIORITY + else + payload[5] = 2; // MEDIUM PRIORITY if (!Client.loggedIn) - payload[5] = 3; //LOW PRIORITY + payload[5] = 3; // LOW PRIORITY - //Write the buffer + // Write the buffer outputStream.write(payload, 0, 6); deadTime = 0; @@ -283,12 +285,12 @@ else if (!Client.loggedIn) return; } catch (IOException ex) { - //ex.printStackTrace(); + // ex.printStackTrace(); } try { socket.close(); } catch (Exception ex) { - //ex.printStackTrace(); + // ex.printStackTrace(); } socket = null; inputStream = null; @@ -312,7 +314,8 @@ public final void provide(int file) { public void provide(int type, int file) { synchronized (requests) { - for (Resource resource = (Resource) requests.reverseGetFirst(); resource != null; resource = (Resource) requests.reverseGetNext()) + for (Resource resource = (Resource) requests + .reverseGetFirst(); resource != null; resource = (Resource) requests.reverseGetNext()) if (resource.dataType == type && resource.ID == file) return; @@ -331,6 +334,7 @@ public int getModelIndex(int i) { return modelIndices[i] & 0xff; } + @Override public void run() { try { while (running) { @@ -358,7 +362,8 @@ public void run() { } boolean idle = false; - for (Resource resource = (Resource) requested.reverseGetFirst(); resource != null; resource = (Resource) requested.reverseGetNext()) + for (Resource resource = (Resource) requested + .reverseGetFirst(); resource != null; resource = (Resource) requested.reverseGetNext()) if (resource.incomplete) { idle = true; resource.loopCycle++; @@ -369,7 +374,8 @@ public void run() { } if (!idle) { - for (Resource resource = (Resource) requested.reverseGetFirst(); resource != null; resource = (Resource) requested.reverseGetNext()) { + for (Resource resource = (Resource) requested + .reverseGetFirst(); resource != null; resource = (Resource) requested.reverseGetNext()) { idle = true; resource.loopCycle++; if (resource.loopCycle > 50) { @@ -395,7 +401,8 @@ public void run() { idleTime = 0; loadingMessage = ""; } - if (Client.loggedIn && socket != null && outputStream != null && (maximumPriority > 0 || clientInstance.indices[0] == null)) { + if (Client.loggedIn && socket != null && outputStream != null + && (maximumPriority > 0 || clientInstance.indices[0] == null)) { deadTime++; if (deadTime > 500) { deadTime = 0; @@ -418,7 +425,7 @@ public void run() { } public void loadExtra(int type, int file) { - if (clientInstance.indices[0] == null){ + if (clientInstance.indices[0] == null) { return; } else if (maximumPriority == 0) { return; @@ -468,7 +475,7 @@ public Resource next() { public int resolve(int regionX, int regionY, int type) { int code = (type << 8) + regionY; - for (int area = 0; area < areas.length; area++) { + for (int area = 0; area < areas.length; area++) { if (areas[area] == code) { if (regionX == 0) { return mapFiles[area] > 3535 ? -1 : mapFiles[area]; @@ -483,10 +490,10 @@ public int resolve(int regionX, int regionY, int type) { public void requestExtra(byte priority, int type, int file) { if (clientInstance.indices[0] == null) return; - //if (versions[type][file] == 0) - // return; + // if (versions[type][file] == 0) + // return; byte[] data = clientInstance.indices[type + 1].decompress(file); - if(crcMatches(crcs[type][file], data)) + if (crcMatches(crcs[type][file], data)) return; fileStatus[type][file] = priority; if (priority > maximumPriority) @@ -504,11 +511,13 @@ public boolean landscapePresent(int landscape) { private void requestMandatory() { uncompletedCount = 0; completedCount = 0; - for (Resource resource = (Resource) requested.reverseGetFirst(); resource != null; resource = (Resource) requested.reverseGetNext()) + for (Resource resource = (Resource) requested + .reverseGetFirst(); resource != null; resource = (Resource) requested.reverseGetNext()) if (resource.incomplete) { uncompletedCount++; - if(!Configuration.JAGCACHED_ENABLED) { - System.out.println("Error: model is incomplete or missing [ type = " + resource.dataType + "] [id = " + resource.ID + "]"); + if (!Configuration.JAGCACHED_ENABLED) { + System.out.println("Error: model is incomplete or missing [ type = " + resource.dataType + + "] [id = " + resource.ID + "]"); } } else completedCount++; @@ -551,9 +560,9 @@ private void loadMandatory() { if (clientInstance.indices[0] != null) data = clientInstance.indices[resource.dataType + 1].decompress(resource.ID); - //CRC MATCHING - if(Configuration.JAGCACHED_ENABLED) { - if(!crcMatches(crcs[resource.dataType][resource.ID], data)) { + // CRC MATCHING + if (Configuration.JAGCACHED_ENABLED) { + if (!crcMatches(crcs[resource.dataType][resource.ID], data)) { data = null; } } @@ -572,7 +581,6 @@ private void loadMandatory() { } } - private void loadExtra() { while (uncompletedCount == 0 && completedCount < 10) { if (maximumPriority == 0) @@ -629,13 +637,15 @@ public boolean highPriorityMusic(int file) { /** * Grabs the checksum of a file from the cache. - * @param type The type of file (0 = model, 1 = anim, 2 = midi, 3 = map). - * @param id The id of the file. + * + * @param type + * The type of file (0 = model, 1 = anim, 2 = midi, 3 = map). + * @param id + * The id of the file. * @return */ - private boolean crcMatches(int expectedValue, byte crcData[]) - { - if(crcData == null || crcData.length < 2) + private boolean crcMatches(int expectedValue, byte crcData[]) { + if (crcData == null || crcData.length < 2) return false; int length = crcData.length - 2; crc32.reset(); @@ -643,12 +653,14 @@ private boolean crcMatches(int expectedValue, byte crcData[]) int crcValue = (int) crc32.getValue(); return crcValue == expectedValue; } + public void writeAll() { - for(int i = 0; i < crcs.length; i++) { + for (int i = 0; i < crcs.length; i++) { writeChecksumList(i); writeVersionList(i); } } + public int getChecksum(int type, int id) { int crc = -1; byte[] data = clientInstance.indices[type + 1].decompress(id); @@ -660,6 +672,7 @@ public int getChecksum(int type, int id) { } return crc; } + public int getVersion(int type, int id) { int version = -1; byte[] data = clientInstance.indices[type + 1].decompress(id); @@ -669,23 +682,27 @@ public int getVersion(int type, int id) { } return version; } + public void writeChecksumList(int type) { try { - DataOutputStream out = new DataOutputStream(new FileOutputStream(SignLink.findcachedir() + type + "_crc.dat")); + DataOutputStream out = new DataOutputStream( + new FileOutputStream(SignLink.findcachedir() + type + "_crc.dat")); int total = 0; for (int index = 0; index < clientInstance.indices[type + 1].getFileCount(); index++) { out.writeInt(getChecksum(type, index)); total++; } - System.out.println(type+"-"+total); + System.out.println(type + "-" + total); out.close(); } catch (Exception e) { e.printStackTrace(); } } + public void writeVersionList(int type) { try { - DataOutputStream out = new DataOutputStream(new FileOutputStream(SignLink.findcachedir() + type + "_version.dat")); + DataOutputStream out = new DataOutputStream( + new FileOutputStream(SignLink.findcachedir() + type + "_version.dat")); for (int index = 0; index < clientInstance.indices[type + 1].getFileCount(); index++) { out.writeShort(getVersion(type, index)); } diff --git a/Elvarg - Client/src/com/runescape/scene/AnimableObject.java b/Elvarg - Client/src/com/runescape/scene/AnimableObject.java index 16b8ece..170c52f 100644 --- a/Elvarg - Client/src/com/runescape/scene/AnimableObject.java +++ b/Elvarg - Client/src/com/runescape/scene/AnimableObject.java @@ -1,4 +1,5 @@ package com.runescape.scene; + import com.runescape.Configuration; import com.runescape.cache.anim.Frame; import com.runescape.cache.anim.Graphic; @@ -13,7 +14,7 @@ public final class AnimableObject extends Renderable { public final int anInt1563; public final int anInt1564; public boolean aBoolean1567; - private final Graphic graphic; + private final Graphic graphic; private int anInt1569; private int anInt1570; private int nextAnimFrameId; @@ -29,19 +30,21 @@ public AnimableObject(int i, int j, int l, int i1, int j1, int k1, int l1) { aBoolean1567 = false; } + @Override public Model getRotatedModel() { Model model = graphic.getModel(); - if(model == null) { + if (model == null) { return null; } int j = graphic.animationSequence.primaryFrames[anInt1569]; Model model_1 = new Model(true, Frame.noAnimationInProgress(j), false, model); System.out.println(Configuration.enableTweening); - if(!aBoolean1567) { + if (!aBoolean1567) { model_1.skin(); - if(Configuration.enableTweening && nextAnimFrameId != -1) { - model_1.applyAnimationFrame(j, graphic.animationSequence.primaryFrames[nextAnimFrameId], anInt1570, graphic.animationSequence.durations[anInt1569]); + if (Configuration.enableTweening && nextAnimFrameId != -1) { + model_1.applyAnimationFrame(j, graphic.animationSequence.primaryFrames[nextAnimFrameId], anInt1570, + graphic.animationSequence.durations[anInt1569]); } else { model_1.applyTransform(j); } @@ -49,18 +52,18 @@ public Model getRotatedModel() { model_1.vertexGroups = null; } - if(graphic.resizeXY != 128 || graphic.resizeZ != 128) { + if (graphic.resizeXY != 128 || graphic.resizeZ != 128) { model_1.scale(graphic.resizeXY, graphic.resizeXY, graphic.resizeZ); } - if(graphic.rotation != 0) { - if(graphic.rotation == 90) { + if (graphic.rotation != 0) { + if (graphic.rotation == 90) { model_1.rotate90Degrees(); } - if(graphic.rotation == 180) { + if (graphic.rotation == 180) { model_1.rotate90Degrees(); model_1.rotate90Degrees(); } - if(graphic.rotation == 270) { + if (graphic.rotation == 270) { model_1.rotate90Degrees(); model_1.rotate90Degrees(); model_1.rotate90Degrees(); @@ -71,10 +74,11 @@ public Model getRotatedModel() { } public void method454(int i) { - for(anInt1570 += i; anInt1570 > graphic.animationSequence.duration(anInt1569);) { + for (anInt1570 += i; anInt1570 > graphic.animationSequence.duration(anInt1569);) { anInt1570 -= graphic.animationSequence.duration(anInt1569) + 1; anInt1569++; - if(anInt1569 >= graphic.animationSequence.frameCount && (anInt1569 < 0 || anInt1569 >= graphic.animationSequence.frameCount)) { + if (anInt1569 >= graphic.animationSequence.frameCount + && (anInt1569 < 0 || anInt1569 >= graphic.animationSequence.frameCount)) { anInt1569 = 0; aBoolean1567 = true; } diff --git a/Elvarg - Client/src/com/runescape/scene/CollisionMap.java b/Elvarg - Client/src/com/runescape/scene/CollisionMap.java index 9b085f0..6c54ee4 100644 --- a/Elvarg - Client/src/com/runescape/scene/CollisionMap.java +++ b/Elvarg - Client/src/com/runescape/scene/CollisionMap.java @@ -1,10 +1,10 @@ package com.runescape.scene; public final class CollisionMap { - + private static final int BLOCKED_TILE = 0x200000; - //private static final int OBJECT_TILE = 0x100; - + // private static final int OBJECT_TILE = 0x100; + private final int xOffset; private final int yOffset; private final int width; @@ -23,8 +23,7 @@ public CollisionMap() { public void initialize() { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) - if (x == 0 || y == 0 || x == width - 1 - || y == height - 1) + if (x == 0 || y == 0 || x == width - 1 || y == height - 1) adjacencies[x][y] = 0xffffff; else adjacencies[x][y] = 0x1000000; @@ -351,38 +350,30 @@ public boolean method219(int i, int j, int k, int i1, int j1, int k1) { if (i1 == 0) { if (j == i - 1 && k == k1) return true; - if (j == i && k == k1 + 1 - && (adjacencies[j][k] & 0x1280120) == 0) + if (j == i && k == k1 + 1 && (adjacencies[j][k] & 0x1280120) == 0) return true; - if (j == i && k == k1 - 1 - && (adjacencies[j][k] & 0x1280102) == 0) + if (j == i && k == k1 - 1 && (adjacencies[j][k] & 0x1280102) == 0) return true; } else if (i1 == 1) { if (j == i && k == k1 + 1) return true; - if (j == i - 1 && k == k1 - && (adjacencies[j][k] & 0x1280108) == 0) + if (j == i - 1 && k == k1 && (adjacencies[j][k] & 0x1280108) == 0) return true; - if (j == i + 1 && k == k1 - && (adjacencies[j][k] & 0x1280180) == 0) + if (j == i + 1 && k == k1 && (adjacencies[j][k] & 0x1280180) == 0) return true; } else if (i1 == 2) { if (j == i + 1 && k == k1) return true; - if (j == i && k == k1 + 1 - && (adjacencies[j][k] & 0x1280120) == 0) + if (j == i && k == k1 + 1 && (adjacencies[j][k] & 0x1280120) == 0) return true; - if (j == i && k == k1 - 1 - && (adjacencies[j][k] & 0x1280102) == 0) + if (j == i && k == k1 - 1 && (adjacencies[j][k] & 0x1280102) == 0) return true; } else if (i1 == 3) { if (j == i && k == k1 - 1) return true; - if (j == i - 1 && k == k1 - && (adjacencies[j][k] & 0x1280108) == 0) + if (j == i - 1 && k == k1 && (adjacencies[j][k] & 0x1280108) == 0) return true; - if (j == i + 1 && k == k1 - && (adjacencies[j][k] & 0x1280180) == 0) + if (j == i + 1 && k == k1 && (adjacencies[j][k] & 0x1280180) == 0) return true; } if (j1 == 2) @@ -391,29 +382,23 @@ public boolean method219(int i, int j, int k, int i1, int j1, int k1) { return true; if (j == i && k == k1 + 1) return true; - if (j == i + 1 && k == k1 - && (adjacencies[j][k] & 0x1280180) == 0) + if (j == i + 1 && k == k1 && (adjacencies[j][k] & 0x1280180) == 0) return true; - if (j == i && k == k1 - 1 - && (adjacencies[j][k] & 0x1280102) == 0) + if (j == i && k == k1 - 1 && (adjacencies[j][k] & 0x1280102) == 0) return true; } else if (i1 == 1) { - if (j == i - 1 && k == k1 - && (adjacencies[j][k] & 0x1280108) == 0) + if (j == i - 1 && k == k1 && (adjacencies[j][k] & 0x1280108) == 0) return true; if (j == i && k == k1 + 1) return true; if (j == i + 1 && k == k1) return true; - if (j == i && k == k1 - 1 - && (adjacencies[j][k] & 0x1280102) == 0) + if (j == i && k == k1 - 1 && (adjacencies[j][k] & 0x1280102) == 0) return true; } else if (i1 == 2) { - if (j == i - 1 && k == k1 - && (adjacencies[j][k] & 0x1280108) == 0) + if (j == i - 1 && k == k1 && (adjacencies[j][k] & 0x1280108) == 0) return true; - if (j == i && k == k1 + 1 - && (adjacencies[j][k] & 0x1280120) == 0) + if (j == i && k == k1 + 1 && (adjacencies[j][k] & 0x1280120) == 0) return true; if (j == i + 1 && k == k1) return true; @@ -422,11 +407,9 @@ public boolean method219(int i, int j, int k, int i1, int j1, int k1) { } else if (i1 == 3) { if (j == i - 1 && k == k1) return true; - if (j == i && k == k1 + 1 - && (adjacencies[j][k] & 0x1280120) == 0) + if (j == i && k == k1 + 1 && (adjacencies[j][k] & 0x1280120) == 0) return true; - if (j == i + 1 && k == k1 - && (adjacencies[j][k] & 0x1280180) == 0) + if (j == i + 1 && k == k1 && (adjacencies[j][k] & 0x1280180) == 0) return true; if (j == i && k == k1 - 1) return true; @@ -494,18 +477,12 @@ public boolean method221(int i, int j, int k, int l, int i1, int j1, int k1) { int i2 = (i + l) - 1; if (k >= j && k <= l1 && k1 >= i && k1 <= i2) return true; - if (k == j - 1 && k1 >= i && k1 <= i2 - && (adjacencies[k - xOffset][k1 - yOffset] & 8) == 0 - && (i1 & 8) == 0) + if (k == j - 1 && k1 >= i && k1 <= i2 && (adjacencies[k - xOffset][k1 - yOffset] & 8) == 0 && (i1 & 8) == 0) return true; - if (k == l1 + 1 && k1 >= i && k1 <= i2 - && (adjacencies[k - xOffset][k1 - yOffset] & 0x80) == 0 - && (i1 & 2) == 0) + if (k == l1 + 1 && k1 >= i && k1 <= i2 && (adjacencies[k - xOffset][k1 - yOffset] & 0x80) == 0 && (i1 & 2) == 0) return true; - return k1 == i - 1 && k >= j && k <= l1 - && (adjacencies[k - xOffset][k1 - yOffset] & 2) == 0 - && (i1 & 4) == 0 || k1 == i2 + 1 && k >= j && k <= l1 - && (adjacencies[k - xOffset][k1 - yOffset] & 0x20) == 0 - && (i1 & 1) == 0; + return k1 == i - 1 && k >= j && k <= l1 && (adjacencies[k - xOffset][k1 - yOffset] & 2) == 0 && (i1 & 4) == 0 + || k1 == i2 + 1 && k >= j && k <= l1 && (adjacencies[k - xOffset][k1 - yOffset] & 0x20) == 0 + && (i1 & 1) == 0; } } diff --git a/Elvarg - Client/src/com/runescape/scene/MapRegion.java b/Elvarg - Client/src/com/runescape/scene/MapRegion.java index f027ad8..864a9e5 100644 --- a/Elvarg - Client/src/com/runescape/scene/MapRegion.java +++ b/Elvarg - Client/src/com/runescape/scene/MapRegion.java @@ -1,4 +1,5 @@ package com.runescape.scene; + import com.runescape.cache.def.FloorDefinition; import com.runescape.cache.def.ObjectDefinition; import com.runescape.draw.Rasterizer3D; @@ -21,11 +22,11 @@ public final class MapRegion { private final byte[][][] shading; private final int[][][] anIntArrayArrayArray135; private final byte[][][] overlayTypes; - private static final int COSINE_VERTICES[] = { 1, 0, -1, 0 }; + private static final int COSINE_VERTICES[] = { 1, 0, -1, 0 }; private final int[][] tileLighting; private static final int anIntArray140[] = { 16, 32, 64, 128 }; private final byte[][][] underlays; - private static final int SINE_VERTICIES[] = { 0, -1, 0, 1 }; + private static final int SINE_VERTICIES[] = { 0, -1, 0, 1 }; public static int maximumPlane = 99; private final int regionSizeX; private final int regionSizeY; @@ -38,27 +39,27 @@ public final class MapRegion { public static final int BRIDGE_TILE = 2; private static final int FORCE_LOWEST_PLANE = 8; - public MapRegion(byte fileFlags[][][], int tileHeights[][][]) { - maximumPlane = 99; + public MapRegion(byte fileFlags[][][], int tileHeights[][][]) { + maximumPlane = 99; regionSizeX = 104; - regionSizeY = 104; - this.tileHeights = tileHeights; + regionSizeY = 104; + this.tileHeights = tileHeights; this.tileFlags = fileFlags; underlays = new byte[4][regionSizeX][regionSizeY]; - overlays = new byte[4][regionSizeX][regionSizeY]; - overlayTypes = new byte[4][regionSizeX][regionSizeY]; - overlayOrientations = new byte[4][regionSizeX][regionSizeY]; + overlays = new byte[4][regionSizeX][regionSizeY]; + overlayTypes = new byte[4][regionSizeX][regionSizeY]; + overlayOrientations = new byte[4][regionSizeX][regionSizeY]; anIntArrayArrayArray135 = new int[4][regionSizeX + 1][regionSizeY + 1]; - shading = new byte[4][regionSizeX + 1][regionSizeY + 1]; - tileLighting = new int[regionSizeX + 1][regionSizeY + 1]; - hues = new int[regionSizeY]; - saturations = new int[regionSizeY]; - luminances = new int[regionSizeY]; - chromas = new int[regionSizeY]; + shading = new byte[4][regionSizeX + 1][regionSizeY + 1]; + tileLighting = new int[regionSizeX + 1][regionSizeY + 1]; + hues = new int[regionSizeY]; + saturations = new int[regionSizeY]; + luminances = new int[regionSizeY]; + chromas = new int[regionSizeY]; anIntArray128 = new int[regionSizeY]; } - private static int calculateNoise(int x, int y) { + private static int calculateNoise(int x, int y) { int k = x + y * 57; k = k << 13 ^ k; int l = k * (k * k * 15731 + 0xc0ae5) + 0x5208dd0d & 0x7fffffff; @@ -67,7 +68,7 @@ private static int calculateNoise(int x, int y) { public final void createRegionScene(CollisionMap maps[], SceneGraph scene) { try { - + for (int z = 0; z < 4; z++) { for (int x = 0; x < 104; x++) { for (int y = 0; y < 104; y++) @@ -85,182 +86,193 @@ public final void createRegionScene(CollisionMap maps[], SceneGraph scene) { for (int z = 0; z < 4; z++) { byte shading[][] = this.shading[z]; byte byte0 = 96; - char diffusion = '\u0300'; - byte lightX = -50; - byte lightY = -10; - byte lightZ = -50; + char diffusion = '\u0300'; + byte lightX = -50; + byte lightY = -10; + byte lightZ = -50; int light = (int) Math.sqrt(lightX * lightX + lightY * lightY + lightZ * lightZ); int l3 = diffusion * light >> 8; - for (int j4 = 1; j4 < regionSizeY - 1; j4++) { - for (int j5 = 1; j5 < regionSizeX - 1; j5++) { - int k6 = tileHeights[z][j5 + 1][j4] - tileHeights[z][j5 - 1][j4]; - int l7 = tileHeights[z][j5][j4 + 1] - tileHeights[z][j5][j4 - 1]; - int j9 = (int) Math.sqrt(k6 * k6 + 0x10000 + l7 * l7); - int k12 = (k6 << 8) / j9; - int l13 = 0x10000 / j9; - int j15 = (l7 << 8) / j9; - int j16 = byte0 + (lightX * k12 + lightY * l13 + lightZ * j15) / l3; - int j17 = (shading[j5 - 1][j4] >> 2) + (shading[j5 + 1][j4] >> 3) + (shading[j5][j4 - 1] >> 2) + (shading[j5][j4 + 1] >> 3) + (shading[j5][j4] >> 1); - tileLighting[j5][j4] = j16 - j17; - } + for (int j4 = 1; j4 < regionSizeY - 1; j4++) { + for (int j5 = 1; j5 < regionSizeX - 1; j5++) { + int k6 = tileHeights[z][j5 + 1][j4] - tileHeights[z][j5 - 1][j4]; + int l7 = tileHeights[z][j5][j4 + 1] - tileHeights[z][j5][j4 - 1]; + int j9 = (int) Math.sqrt(k6 * k6 + 0x10000 + l7 * l7); + int k12 = (k6 << 8) / j9; + int l13 = 0x10000 / j9; + int j15 = (l7 << 8) / j9; + int j16 = byte0 + (lightX * k12 + lightY * l13 + lightZ * j15) / l3; + int j17 = (shading[j5 - 1][j4] >> 2) + (shading[j5 + 1][j4] >> 3) + (shading[j5][j4 - 1] >> 2) + + (shading[j5][j4 + 1] >> 3) + (shading[j5][j4] >> 1); + tileLighting[j5][j4] = j16 - j17; + } - } + } - for (int k5 = 0; k5 < regionSizeY; k5++) { - hues[k5] = 0; - saturations[k5] = 0; - luminances[k5] = 0; - chromas[k5] = 0; - anIntArray128[k5] = 0; - } + for (int k5 = 0; k5 < regionSizeY; k5++) { + hues[k5] = 0; + saturations[k5] = 0; + luminances[k5] = 0; + chromas[k5] = 0; + anIntArray128[k5] = 0; + } - for (int l6 = -5; l6 < regionSizeX + 5; l6++) { - for (int i8 = 0; i8 < regionSizeY; i8++) { - int k9 = l6 + 5; - if (k9 >= 0 && k9 < regionSizeX) { - int l12 = underlays[z][k9][i8] & 0xff; - if (l12 > 0) { - if (l12 > FloorDefinition.underlays.length) { - l12 = FloorDefinition.underlays.length; + for (int l6 = -5; l6 < regionSizeX + 5; l6++) { + for (int i8 = 0; i8 < regionSizeY; i8++) { + int k9 = l6 + 5; + if (k9 >= 0 && k9 < regionSizeX) { + int l12 = underlays[z][k9][i8] & 0xff; + if (l12 > 0) { + if (l12 > FloorDefinition.underlays.length) { + l12 = FloorDefinition.underlays.length; + } + FloorDefinition flo = FloorDefinition.underlays[l12 - 1]; + hues[i8] += flo.blendHue; + saturations[i8] += flo.saturation; + luminances[i8] += flo.luminance; + chromas[i8] += flo.blendHueMultiplier; + anIntArray128[i8]++; } - FloorDefinition flo = FloorDefinition.underlays[l12 - 1]; - hues[i8] += flo.blendHue; - saturations[i8] += flo.saturation; - luminances[i8] += flo.luminance; - chromas[i8] += flo.blendHueMultiplier; - anIntArray128[i8]++; } - } - int i13 = l6 - 5; - if (i13 >= 0 && i13 < regionSizeX) { - int i14 = underlays[z][i13][i8] & 0xff; - if (i14 > 0) { - FloorDefinition flo_1 = FloorDefinition.underlays[i14 - 1]; - hues[i8] -= flo_1.blendHue; - saturations[i8] -= flo_1.saturation; - luminances[i8] -= flo_1.luminance; - chromas[i8] -= flo_1.blendHueMultiplier; - anIntArray128[i8]--; + int i13 = l6 - 5; + if (i13 >= 0 && i13 < regionSizeX) { + int i14 = underlays[z][i13][i8] & 0xff; + if (i14 > 0) { + FloorDefinition flo_1 = FloorDefinition.underlays[i14 - 1]; + hues[i8] -= flo_1.blendHue; + saturations[i8] -= flo_1.saturation; + luminances[i8] -= flo_1.luminance; + chromas[i8] -= flo_1.blendHueMultiplier; + anIntArray128[i8]--; + } } } - } - if (l6 >= 1 && l6 < regionSizeX - 1) { - int l9 = 0; - int j13 = 0; - int j14 = 0; - int k15 = 0; - int k16 = 0; - for (int k17 = -5; k17 < regionSizeY + 5; k17++) { - int j18 = k17 + 5; - if (j18 >= 0 && j18 < regionSizeY) { - l9 += hues[j18]; - j13 += saturations[j18]; - j14 += luminances[j18]; - k15 += chromas[j18]; - k16 += anIntArray128[j18]; - } - int k18 = k17 - 5; - if (k18 >= 0 && k18 < regionSizeY) { - l9 -= hues[k18]; - j13 -= saturations[k18]; - j14 -= luminances[k18]; - k15 -= chromas[k18]; - k16 -= anIntArray128[k18]; - } - if (k17 >= 1 && k17 < regionSizeY - 1 && (!lowMem || (tileFlags[0][l6][k17] & 2) != 0 || (tileFlags[z][l6][k17] & 0x10) == 0 && getCollisionPlane(k17, z, l6) == anInt131)) { - if (z < maximumPlane) - maximumPlane = z; - int l18 = underlays[z][l6][k17] & 0xff; - int i19 = overlays[z][l6][k17] & 0xff; - if (l18 > 0 || i19 > 0) { - int j19 = tileHeights[z][l6][k17]; - int k19 = tileHeights[z][l6 + 1][k17]; - int l19 = tileHeights[z][l6 + 1][k17 + 1]; - int i20 = tileHeights[z][l6][k17 + 1]; - int j20 = tileLighting[l6][k17]; - int k20 = tileLighting[l6 + 1][k17]; - int l20 = tileLighting[l6 + 1][k17 + 1]; - int i21 = tileLighting[l6][k17 + 1]; - int j21 = -1; - int k21 = -1; - if (l18 > 0) { - int l21 = (l9 * 256) / k15; - int j22 = j13 / k16; - int l22 = j14 / k16; - j21 = encode(l21, j22, l22); - - if (l22 < 0) - l22 = 0; - else if (l22 > 255) - l22 = 255; - - k21 = encode(l21, j22, l22); - } - if (z > 0) { - boolean flag = true; - if (l18 == 0 && overlayTypes[z][l6][k17] != 0) - flag = false; - if (i19 > 0 && !FloorDefinition.overlays[i19 - 1].occlude) - flag = false; - if (flag && j19 == k19 && j19 == l19 && j19 == i20) - anIntArrayArrayArray135[z][l6][k17] |= 0x924; - } - int i22 = 0; - if (j21 != -1) - i22 = Rasterizer3D.hslToRgb[method187(k21, 96)]; - if (i19 == 0) { - scene.addTile(z, l6, k17, 0, 0, -1, j19, k19, l19, i20, method187(j21, j20), method187(j21, k20), method187(j21, l20), method187(j21, i21), 0, 0, 0, 0, i22, 0); - } else { - - int k22 = overlayTypes[z][l6][k17] + 1; - byte byte4 = overlayOrientations[z][l6][k17]; - if (i19 - 1 > FloorDefinition.overlays.length) { - i19 = FloorDefinition.overlays.length; + if (l6 >= 1 && l6 < regionSizeX - 1) { + int l9 = 0; + int j13 = 0; + int j14 = 0; + int k15 = 0; + int k16 = 0; + for (int k17 = -5; k17 < regionSizeY + 5; k17++) { + int j18 = k17 + 5; + if (j18 >= 0 && j18 < regionSizeY) { + l9 += hues[j18]; + j13 += saturations[j18]; + j14 += luminances[j18]; + k15 += chromas[j18]; + k16 += anIntArray128[j18]; + } + int k18 = k17 - 5; + if (k18 >= 0 && k18 < regionSizeY) { + l9 -= hues[k18]; + j13 -= saturations[k18]; + j14 -= luminances[k18]; + k15 -= chromas[k18]; + k16 -= anIntArray128[k18]; + } + if (k17 >= 1 && k17 < regionSizeY - 1 + && (!lowMem || (tileFlags[0][l6][k17] & 2) != 0 + || (tileFlags[z][l6][k17] & 0x10) == 0 + && getCollisionPlane(k17, z, l6) == anInt131)) { + if (z < maximumPlane) + maximumPlane = z; + int l18 = underlays[z][l6][k17] & 0xff; + int i19 = overlays[z][l6][k17] & 0xff; + if (l18 > 0 || i19 > 0) { + int j19 = tileHeights[z][l6][k17]; + int k19 = tileHeights[z][l6 + 1][k17]; + int l19 = tileHeights[z][l6 + 1][k17 + 1]; + int i20 = tileHeights[z][l6][k17 + 1]; + int j20 = tileLighting[l6][k17]; + int k20 = tileLighting[l6 + 1][k17]; + int l20 = tileLighting[l6 + 1][k17 + 1]; + int i21 = tileLighting[l6][k17 + 1]; + int j21 = -1; + int k21 = -1; + if (l18 > 0) { + int l21 = (l9 * 256) / k15; + int j22 = j13 / k16; + int l22 = j14 / k16; + j21 = encode(l21, j22, l22); + + if (l22 < 0) + l22 = 0; + else if (l22 > 255) + l22 = 255; + + k21 = encode(l21, j22, l22); } - FloorDefinition overlay_flo = FloorDefinition.overlays[i19 - 1]; - int textureId = overlay_flo.texture; - int j23; - int minimapColor; - - if (textureId > 50) { - textureId = -1; + if (z > 0) { + boolean flag = true; + if (l18 == 0 && overlayTypes[z][l6][k17] != 0) + flag = false; + if (i19 > 0 && !FloorDefinition.overlays[i19 - 1].occlude) + flag = false; + if (flag && j19 == k19 && j19 == l19 && j19 == i20) + anIntArrayArrayArray135[z][l6][k17] |= 0x924; } - if (textureId >= 0) { - minimapColor = Rasterizer3D.getOverallColour(textureId); - j23 = -1; - } else if (overlay_flo.rgb == 0xff00ff) { - minimapColor = 0; - j23 = -2; - textureId = -1; - } else if(overlay_flo.rgb == 0x333333) { - minimapColor = Rasterizer3D.hslToRgb[checkedLight(overlay_flo.hsl16, 96)]; - j23 = -2; - textureId = -1; + int i22 = 0; + if (j21 != -1) + i22 = Rasterizer3D.hslToRgb[method187(k21, 96)]; + if (i19 == 0) { + scene.addTile(z, l6, k17, 0, 0, -1, j19, k19, l19, i20, method187(j21, j20), + method187(j21, k20), method187(j21, l20), method187(j21, i21), 0, 0, 0, + 0, i22, 0); } else { - j23 = encode(overlay_flo.hue, overlay_flo.saturation, overlay_flo.luminance); - minimapColor = Rasterizer3D.hslToRgb[checkedLight(overlay_flo.hsl16, 96)]; - } - - if (minimapColor == 0x000000 && overlay_flo.anotherRgb != -1) { - int newMinimapColor = encode(overlay_flo.anotherHue, overlay_flo.anotherSaturation, overlay_flo.anotherLuminance); - minimapColor = Rasterizer3D.hslToRgb[checkedLight(newMinimapColor, 96)]; - } - scene.addTile(z, l6, k17, k22, byte4, textureId, j19, k19, l19, i20, method187(j21, j20), method187(j21, k20), method187(j21, l20), method187(j21, i21), checkedLight(j23, j20), checkedLight(j23, k20), checkedLight(j23, l20), checkedLight(j23, i21), i22, minimapColor); + int k22 = overlayTypes[z][l6][k17] + 1; + byte byte4 = overlayOrientations[z][l6][k17]; + if (i19 - 1 > FloorDefinition.overlays.length) { + i19 = FloorDefinition.overlays.length; + } + FloorDefinition overlay_flo = FloorDefinition.overlays[i19 - 1]; + int textureId = overlay_flo.texture; + int j23; + int minimapColor; + + if (textureId > 50) { + textureId = -1; + } + if (textureId >= 0) { + minimapColor = Rasterizer3D.getOverallColour(textureId); + j23 = -1; + } else if (overlay_flo.rgb == 0xff00ff) { + minimapColor = 0; + j23 = -2; + textureId = -1; + } else if (overlay_flo.rgb == 0x333333) { + minimapColor = Rasterizer3D.hslToRgb[checkedLight(overlay_flo.hsl16, 96)]; + j23 = -2; + textureId = -1; + } else { + j23 = encode(overlay_flo.hue, overlay_flo.saturation, + overlay_flo.luminance); + minimapColor = Rasterizer3D.hslToRgb[checkedLight(overlay_flo.hsl16, 96)]; + } + + if (minimapColor == 0x000000 && overlay_flo.anotherRgb != -1) { + int newMinimapColor = encode(overlay_flo.anotherHue, + overlay_flo.anotherSaturation, overlay_flo.anotherLuminance); + minimapColor = Rasterizer3D.hslToRgb[checkedLight(newMinimapColor, 96)]; + } + + scene.addTile(z, l6, k17, k22, byte4, textureId, j19, k19, l19, i20, + method187(j21, j20), method187(j21, k20), method187(j21, l20), + method187(j21, i21), checkedLight(j23, j20), checkedLight(j23, k20), + checkedLight(j23, l20), checkedLight(j23, i21), i22, minimapColor); + } } } } - } + } } - } - for (int j8 = 1; j8 < regionSizeY - 1; j8++) { - for (int i10 = 1; i10 < regionSizeX - 1; i10++) - scene.setTileLogicHeight(z, i10, j8, getCollisionPlane(j8, z, i10)); + for (int j8 = 1; j8 < regionSizeY - 1; j8++) { + for (int i10 = 1; i10 < regionSizeX - 1; i10++) + scene.setTileLogicHeight(z, i10, j8, getCollisionPlane(j8, z, i10)); - } + } } scene.shadeModels(-10, -50, -50); @@ -311,7 +323,8 @@ else if (l22 > 255) char c1 = '\360'; int k14 = tileHeights[k8][i4][k4] - c1; int l15 = tileHeights[i7][i4][k4]; - SceneGraph.createNewSceneCluster(l2, i4 * 128, l15, i4 * 128, l5 * 128 + 128, k14, k4 * 128, 1); + SceneGraph.createNewSceneCluster(l2, i4 * 128, l15, i4 * 128, l5 * 128 + 128, k14, + k4 * 128, 1); for (int l16 = i7; l16 <= k8; l16++) { for (int l17 = k4; l17 <= l5; l17++) anIntArrayArrayArray135[l16][i4][l17] &= ~i2; @@ -348,7 +361,8 @@ else if (l22 > 255) char c2 = '\360'; int l14 = tileHeights[l8][l4][k3] - c2; int i16 = tileHeights[j7][l4][k3]; - SceneGraph.createNewSceneCluster(l2, l4 * 128, i16, i6 * 128 + 128, k3 * 128, l14, k3 * 128, 2); + SceneGraph.createNewSceneCluster(l2, l4 * 128, i16, i6 * 128 + 128, k3 * 128, l14, + k3 * 128, 2); for (int i17 = j7; i17 <= l8; i17++) { for (int i18 = l4; i18 <= i6; i18++) anIntArrayArrayArray135[i17][i18][k3] &= ~j2; @@ -382,7 +396,8 @@ else if (l22 > 255) if (((j6 - i5) + 1) * ((i9 - k7) + 1) >= 4) { int j12 = tileHeights[i3][i5][k7]; - SceneGraph.createNewSceneCluster(l2, i5 * 128, j12, j6 * 128 + 128, i9 * 128 + 128, j12, k7 * 128, 4); + SceneGraph.createNewSceneCluster(l2, i5 * 128, j12, j6 * 128 + 128, i9 * 128 + 128, + j12, k7 * 128, 4); for (int k13 = i5; k13 <= j6; k13++) { for (int i15 = k7; i15 <= i9; i15++) anIntArrayArrayArray135[i3][k13][i15] &= ~k2; @@ -403,47 +418,47 @@ else if (l22 > 255) } } - private static int calculateVertexHeight(int i, int j) { - int mapHeight = (interpolatedNoise(i + 45365, j + 0x16713, 4) - 128) + (interpolatedNoise(i + 10294, j + 37821, 2) - 128 >> 1) + (interpolatedNoise(i, j, 1) - 128 >> 2); - mapHeight = (int) ((double) mapHeight * 0.29999999999999999D) + 35; + private static int calculateVertexHeight(int i, int j) { + int mapHeight = (interpolatedNoise(i + 45365, j + 0x16713, 4) - 128) + + (interpolatedNoise(i + 10294, j + 37821, 2) - 128 >> 1) + (interpolatedNoise(i, j, 1) - 128 >> 2); + mapHeight = (int) (mapHeight * 0.29999999999999999D) + 35; if (mapHeight < 10) { mapHeight = 10; - } - else if (mapHeight > 60) { + } else if (mapHeight > 60) { mapHeight = 60; } return mapHeight; } - public static void passiveRequestGameObjectModels(Buffer buffer, ResourceProvider resourceProvider) { + public static void passiveRequestGameObjectModels(Buffer buffer, ResourceProvider resourceProvider) { label0: { - int gameObjectId = -1; - do { - int gameObjectIdOffset = buffer.readUSmart2(); - - if (gameObjectIdOffset == 0) { - break label0; - } - gameObjectId += gameObjectIdOffset ; - - ObjectDefinition objectDefinition = ObjectDefinition.lookup(gameObjectId ); - objectDefinition.loadModels(resourceProvider); + int gameObjectId = -1; do { - int terminate = buffer.readUSmart(); + int gameObjectIdOffset = buffer.readUSmart2(); - if (terminate == 0) { - break; + if (gameObjectIdOffset == 0) { + break label0; } - buffer.readUnsignedByte(); + gameObjectId += gameObjectIdOffset; + + ObjectDefinition objectDefinition = ObjectDefinition.lookup(gameObjectId); + objectDefinition.loadModels(resourceProvider); + do { + int terminate = buffer.readUSmart(); + + if (terminate == 0) { + break; + } + buffer.readUnsignedByte(); + } while (true); } while (true); - } while (true); - } + } } - public final void initiateVertexHeights(int yOffset, int yLength, int xLength, int xOffset) { + public final void initiateVertexHeights(int yOffset, int yLength, int xLength, int xOffset) { for (int y = yOffset; y <= yOffset + yLength; y++) { - for (int x = xOffset; x <= xOffset + xLength; x++) { - if (x >= 0 && x < regionSizeX && y >= 0 && y < regionSizeY) { + for (int x = xOffset; x <= xOffset + xLength; x++) { + if (x >= 0 && x < regionSizeX && y >= 0 && y < regionSizeY) { shading[0][x][y] = 127; if (x == xOffset && x > 0) { tileHeights[0][x][y] = tileHeights[0][x - 1][y]; @@ -462,7 +477,7 @@ public final void initiateVertexHeights(int yOffset, int yLength, int xLength, i } } - private void renderObject(int y, SceneGraph scene, CollisionMap class11, int type, int z, int x, int id, int j1) { + private void renderObject(int y, SceneGraph scene, CollisionMap class11, int type, int z, int x, int id, int j1) { if (lowMem && (tileFlags[0][x][y] & BRIDGE_TILE) == 0) { if ((tileFlags[z][x][y] & 0x10) != 0) { return; @@ -517,7 +532,8 @@ private void renderObject(int y, SceneGraph scene, CollisionMap class11, int typ j4 = definition.objectSizeX; l4 = definition.objectSizeY; } - if (scene.addTiledObject(key, config, mean, l4, ((Renderable) (obj1)), j4, z, i5, y, x) && definition.castsShadow) { + if (scene.addTiledObject(key, config, mean, l4, ((Renderable) (obj1)), j4, z, i5, y, x) + && definition.castsShadow) { Model model; if (obj1 instanceof Model) model = (Model) obj1; @@ -628,7 +644,8 @@ else if (j1 == 3) obj11 = new SceneObject(id, 4 + j1, 2, east, northEast, center, north, definition.animation, true); obj12 = new SceneObject(id, i3, 2, east, northEast, center, north, definition.animation, true); } - scene.addWallObject(anIntArray152[j1], ((Renderable) (obj11)), key, y, config, x, ((Renderable) (obj12)), mean, anIntArray152[i3], z); + scene.addWallObject(anIntArray152[j1], ((Renderable) (obj11)), key, y, config, x, ((Renderable) (obj12)), + mean, anIntArray152[i3], z); if (definition.occludes) if (j1 == 0) { anIntArrayArrayArray135[z][x][y] |= 0x249; @@ -707,7 +724,8 @@ else if (j1 == 3) obj7 = definition.modelAt(4, 0, center, east, northEast, north, -1); else obj7 = new SceneObject(id, 0, 4, east, northEast, center, north, definition.animation, true); - scene.addWallDecoration(key, y, j1 * 512, z, 0, mean, ((Renderable) (obj7)), x, config, 0, anIntArray152[j1]); + scene.addWallDecoration(key, y, j1 * 512, z, 0, mean, ((Renderable) (obj7)), x, config, 0, + anIntArray152[j1]); return; } if (type == 5) { @@ -720,7 +738,8 @@ else if (j1 == 3) obj13 = definition.modelAt(4, 0, center, east, northEast, north, -1); else obj13 = new SceneObject(id, 0, 4, east, northEast, center, north, definition.animation, true); - scene.addWallDecoration(key, y, j1 * 512, z, COSINE_VERTICES[j1] * i4, mean, ((Renderable) (obj13)), x, config, SINE_VERTICIES[j1] * i4, anIntArray152[j1]); + scene.addWallDecoration(key, y, j1 * 512, z, COSINE_VERTICES[j1] * i4, mean, ((Renderable) (obj13)), x, + config, SINE_VERTICIES[j1] * i4, anIntArray152[j1]); return; } if (type == 6) { @@ -768,9 +787,12 @@ private static int interpolatedNoise(int x, int y, int frequencyReciprocal) { /** * Encodes the hue, saturation, and luminance into a colour value. * - * @param hue The hue. - * @param saturation The saturation. - * @param luminance The luminance. + * @param hue + * The hue. + * @param saturation + * The saturation. + * @param luminance + * The luminance. * @return The colour. */ private int encode(int hue, int saturation, int luminance) { @@ -794,7 +816,8 @@ public static boolean modelReady(int i, int j) { return class46.method577(j); } - public final void method179(int i, int j, CollisionMap aclass11[], int l, int i1, byte abyte0[], int j1, int k1, int l1) { + public final void method179(int i, int j, CollisionMap aclass11[], int l, int i1, byte abyte0[], int j1, int k1, + int l1) { for (int i2 = 0; i2 < 8; i2++) { for (int j2 = 0; j2 < 8; j2++) if (l + i2 > 0 && l + i2 < 103 && l1 + j2 > 0 && l1 + j2 < 103) @@ -806,7 +829,8 @@ public final void method179(int i, int j, CollisionMap aclass11[], int l, int i1 for (int i3 = 0; i3 < 64; i3++) { for (int j3 = 0; j3 < 64; j3++) if (l2 == i && i3 >= i1 && i3 < i1 + 8 && j3 >= j1 && j3 < j1 + 8) - method181(l1 + ChunkUtil.method156(j3 & 7, j, i3 & 7), 0, stream, l + ChunkUtil.method155(j, j3 & 7, i3 & 7), k1, j, 0); + method181(l1 + ChunkUtil.method156(j3 & 7, j, i3 & 7), 0, stream, + l + ChunkUtil.method155(j, j3 & 7, i3 & 7), k1, j, 0); else method181(-1, 0, stream, -1, 0, 0, 0); @@ -889,12 +913,15 @@ private void method181(int i, int j, Buffer stream, int k, int l, int i1, int k1 } /** - * Returns the plane that actually contains the collision flag, to adjust for objects such as bridges. TODO better - * name + * Returns the plane that actually contains the collision flag, to adjust + * for objects such as bridges. TODO better name * - * @param x The x coordinate. - * @param y The y coordinate. - * @param z The z coordinate. + * @param x + * The x coordinate. + * @param y + * The y coordinate. + * @param z + * The z coordinate. * @return The correct z coordinate. */ private int getCollisionPlane(int y, int z, int x) { @@ -908,49 +935,50 @@ private int getCollisionPlane(int y, int z, int x) { } } - public final void method183(CollisionMap aclass11[], SceneGraph worldController, int i, int j, int k, int l, byte abyte0[], int i1, int j1, int k1) { + public final void method183(CollisionMap aclass11[], SceneGraph worldController, int i, int j, int k, int l, + byte abyte0[], int i1, int j1, int k1) { label0: { - Buffer stream = new Buffer(abyte0); - int l1 = -1; - do { - int i2 = stream.readUSmart2(); - if (i2 == 0) - break label0; - l1 += i2; - int j2 = 0; + Buffer stream = new Buffer(abyte0); + int l1 = -1; do { - int k2 = stream.readUSmart(); - if (k2 == 0) - break; - j2 += k2 - 1; - int l2 = j2 & 0x3f; - int i3 = j2 >> 6 & 0x3f; + int i2 = stream.readUSmart2(); + if (i2 == 0) + break label0; + l1 += i2; + int j2 = 0; + do { + int k2 = stream.readUSmart(); + if (k2 == 0) + break; + j2 += k2 - 1; + int l2 = j2 & 0x3f; + int i3 = j2 >> 6 & 0x3f; int j3 = j2 >> 12; - int k3 = stream.readUnsignedByte(); - int l3 = k3 >> 2; - int i4 = k3 & 3; - if (j3 == i && i3 >= i1 && i3 < i1 + 8 && l2 >= k && l2 < k + 8) { - ObjectDefinition class46 = ObjectDefinition.lookup(l1); - int j4 = j + ChunkUtil.method157(j1, class46.objectSizeY, i3 & 7, l2 & 7, class46.objectSizeX); - int k4 = k1 + ChunkUtil.method158(l2 & 7, class46.objectSizeY, j1, class46.objectSizeX, i3 & 7); - if (j4 > 0 && k4 > 0 && j4 < 103 && k4 < 103) { - int l4 = j3; - if ((tileFlags[1][j4][k4] & 2) == 2) - l4--; - CollisionMap class11 = null; - if (l4 >= 0) - class11 = aclass11[l4]; - renderObject(k4, worldController, class11, l3, l, j4, l1, i4 + j1 & 3); - } - } + int k3 = stream.readUnsignedByte(); + int l3 = k3 >> 2; + int i4 = k3 & 3; + if (j3 == i && i3 >= i1 && i3 < i1 + 8 && l2 >= k && l2 < k + 8) { + ObjectDefinition class46 = ObjectDefinition.lookup(l1); + int j4 = j + ChunkUtil.method157(j1, class46.objectSizeY, i3 & 7, l2 & 7, class46.objectSizeX); + int k4 = k1 + ChunkUtil.method158(l2 & 7, class46.objectSizeY, j1, class46.objectSizeX, i3 & 7); + if (j4 > 0 && k4 > 0 && j4 < 103 && k4 < 103) { + int l4 = j3; + if ((tileFlags[1][j4][k4] & 2) == 2) + l4--; + CollisionMap class11 = null; + if (l4 >= 0) + class11 = aclass11[l4]; + renderObject(k4, worldController, class11, l3, l, j4, l1, i4 + j1 & 3); + } + } + } while (true); } while (true); - } while (true); - } + } } private static int interpolate(int a, int b, int angle, int frequencyReciprocal) { int cosine = 0x10000 - Rasterizer3D.COSINE[(angle * 1024) / frequencyReciprocal] >> 1; - return (a * (0x10000 - cosine) >> 16) + (b * cosine >> 16); + return (a * (0x10000 - cosine) >> 16) + (b * cosine >> 16); } private int checkedLight(int color, int light) { @@ -973,8 +1001,10 @@ else if (light > 126) } private static int smoothNoise(int x, int y) { - int corners = calculateNoise(x - 1, y - 1) + calculateNoise(x + 1, y - 1) + calculateNoise(x - 1, y + 1) + calculateNoise(x + 1, y + 1); - int sides = calculateNoise(x - 1, y) + calculateNoise(x + 1, y) + calculateNoise(x, y - 1) + calculateNoise(x, y + 1); + int corners = calculateNoise(x - 1, y - 1) + calculateNoise(x + 1, y - 1) + calculateNoise(x - 1, y + 1) + + calculateNoise(x + 1, y + 1); + int sides = calculateNoise(x - 1, y) + calculateNoise(x + 1, y) + calculateNoise(x, y - 1) + + calculateNoise(x, y + 1); int center = calculateNoise(x, y); return corners / 16 + sides / 8 + center / 4; } @@ -990,7 +1020,8 @@ else if (j > 126) return (i & 0xff80) + j; } - public static void placeObject(SceneGraph worldController, int i, int j, int k, int l, CollisionMap class11, int ai[][][], int i1, int j1, int k1) { + public static void placeObject(SceneGraph worldController, int i, int j, int k, int l, CollisionMap class11, + int ai[][][], int i1, int j1, int k1) { int l1 = ai[l][i1][j]; int i2 = ai[l][i1 + 1][j]; int j2 = ai[l][i1 + 1][j + 1]; @@ -1081,7 +1112,8 @@ public static void placeObject(SceneGraph worldController, int i, int j, int k, obj11 = new SceneObject(j1, 4 + i, 2, i2, j2, l1, k2, class46.animation, true); obj12 = new SceneObject(j1, j3, 2, i2, j2, l1, k2, class46.animation, true); } - worldController.addWallObject(anIntArray152[i], ((Renderable) (obj11)), i3, j, byte1, i1, ((Renderable) (obj12)), l2, anIntArray152[j3], k1); + worldController.addWallObject(anIntArray152[i], ((Renderable) (obj11)), i3, j, byte1, i1, + ((Renderable) (obj12)), l2, anIntArray152[j3], k1); if (class46.solid) class11.method211(j, i, i1, k, class46.impenetrable); return; @@ -1135,7 +1167,8 @@ public static void placeObject(SceneGraph worldController, int i, int j, int k, obj7 = class46.modelAt(4, 0, l1, i2, j2, k2, -1); else obj7 = new SceneObject(j1, 0, 4, i2, j2, l1, k2, class46.animation, true); - worldController.addWallDecoration(i3, j, i * 512, k1, 0, l2, ((Renderable) (obj7)), i1, byte1, 0, anIntArray152[i]); + worldController.addWallDecoration(i3, j, i * 512, k1, 0, l2, ((Renderable) (obj7)), i1, byte1, 0, + anIntArray152[i]); return; } if (k == 5) { @@ -1148,7 +1181,8 @@ public static void placeObject(SceneGraph worldController, int i, int j, int k, obj13 = class46.modelAt(4, 0, l1, i2, j2, k2, -1); else obj13 = new SceneObject(j1, 0, 4, i2, j2, l1, k2, class46.animation, true); - worldController.addWallDecoration(i3, j, i * 512, k1, COSINE_VERTICES[i] * j4, l2, ((Renderable) (obj13)), i1, byte1, SINE_VERTICIES[i] * j4, anIntArray152[i]); + worldController.addWallDecoration(i3, j, i * 512, k1, COSINE_VERTICES[i] * j4, l2, ((Renderable) (obj13)), + i1, byte1, SINE_VERTICIES[i] * j4, anIntArray152[i]); return; } if (k == 6) { @@ -1207,16 +1241,16 @@ public static boolean method189(int i, byte[] is, int i_250_) // xxx bad i_254_ += i_257_ - 1; int i_258_ = i_254_ & 0x3f; int i_259_ = i_254_ >> 6 & 0x3f; - int i_260_ = stream.readUnsignedByte() >> 2; - int i_261_ = i_259_ + i; - int i_262_ = i_258_ + i_250_; - if (i_261_ > 0 && i_262_ > 0 && i_261_ < 103 && i_262_ < 103) { - ObjectDefinition class46 = ObjectDefinition.lookup(i_252_); - if (i_260_ != 22 || !lowMem || class46.isInteractive || class46.obstructsGround) { - bool &= class46.method579(); - bool_255_ = true; - } - } + int i_260_ = stream.readUnsignedByte() >> 2; + int i_261_ = i_259_ + i; + int i_262_ = i_258_ + i_250_; + if (i_261_ > 0 && i_262_ > 0 && i_261_ < 103 && i_262_ < 103) { + ObjectDefinition class46 = ObjectDefinition.lookup(i_252_); + if (i_260_ != 22 || !lowMem || class46.isInteractive || class46.obstructsGround) { + bool &= class46.method579(); + bool_255_ = true; + } + } } } } @@ -1225,24 +1259,24 @@ public static boolean method189(int i, byte[] is, int i_250_) // xxx bad public final void method190(int i, CollisionMap aclass11[], int j, SceneGraph worldController, byte abyte0[]) { label0: { - Buffer stream = new Buffer(abyte0); - int l = -1; - do { - int i1 = stream.readUSmart(); - if (i1 == 0) - break label0; - l += i1; - int j1 = 0; + Buffer stream = new Buffer(abyte0); + int l = -1; do { - int k1 = stream.readUSmart(); - if (k1 == 0) - break; - j1 += k1 - 1; - int l1 = j1 & 0x3f; - int i2 = j1 >> 6 & 0x3f; - int j2 = j1 >> 12; - int k2 = stream.readUnsignedByte(); - int l2 = k2 >> 2; + int i1 = stream.readUSmart(); + if (i1 == 0) + break label0; + l += i1; + int j1 = 0; + do { + int k1 = stream.readUSmart(); + if (k1 == 0) + break; + j1 += k1 - 1; + int l1 = j1 & 0x3f; + int i2 = j1 >> 6 & 0x3f; + int j2 = j1 >> 12; + int k2 = stream.readUnsignedByte(); + int l2 = k2 >> 2; int i3 = k2 & 3; int j3 = i2 + i; int k3 = l1 + j; @@ -1255,8 +1289,8 @@ public final void method190(int i, CollisionMap aclass11[], int j, SceneGraph wo class11 = aclass11[l3]; renderObject(k3, worldController, class11, l2, j2, j3, l, i3); } + } while (true); } while (true); - } while (true); - } + } } } diff --git a/Elvarg - Client/src/com/runescape/scene/Projectile.java b/Elvarg - Client/src/com/runescape/scene/Projectile.java index 20a9295..355757d 100644 --- a/Elvarg - Client/src/com/runescape/scene/Projectile.java +++ b/Elvarg - Client/src/com/runescape/scene/Projectile.java @@ -1,11 +1,12 @@ package com.runescape.scene; + import com.runescape.cache.anim.Frame; import com.runescape.cache.anim.Graphic; import com.runescape.entity.Renderable; import com.runescape.entity.model.Model; public final class Projectile extends Renderable { - + public final int startCycle; public final int stopCycle; private double xIncrement; @@ -32,41 +33,43 @@ public final class Projectile extends Renderable { public final int projectileZ; public void calculateIncrements(int currentCycle, int targetY, int targetCenterHeight, int targetX) { - if(!started) { + if (!started) { double xToGo = targetX - projectileX; double yToGo = targetY - projectileY; double distanceToGo = Math.sqrt(xToGo * xToGo + yToGo * yToGo); - xPos = (double) projectileX + (xToGo * (double) initialDistance) / distanceToGo; - yPos = (double) projectileY + (yToGo * (double) initialDistance) / distanceToGo; + xPos = projectileX + (xToGo * initialDistance) / distanceToGo; + yPos = projectileY + (yToGo * initialDistance) / distanceToGo; cnterHeight = startHeight; } double cyclesLeft = (stopCycle + 1) - currentCycle; - xIncrement = ((double)targetX - xPos) / cyclesLeft; - yIncrement = ((double)targetY - yPos) / cyclesLeft; + xIncrement = (targetX - xPos) / cyclesLeft; + yIncrement = (targetY - yPos) / cyclesLeft; diagonalIncrement = Math.sqrt(xIncrement * xIncrement + yIncrement * yIncrement); - if(!started) { - heightIncrement = -diagonalIncrement * Math.tan((double) initialSlope * 0.02454369D); + if (!started) { + heightIncrement = -diagonalIncrement * Math.tan(initialSlope * 0.02454369D); } - aDouble1578 = (2D * ((double)targetCenterHeight - cnterHeight - heightIncrement * cyclesLeft)) / (cyclesLeft * cyclesLeft); + aDouble1578 = (2D * (targetCenterHeight - cnterHeight - heightIncrement * cyclesLeft)) + / (cyclesLeft * cyclesLeft); } + @Override public Model getRotatedModel() { Model modelGfx = projectileGFX.getModel(); - if(modelGfx == null) { + if (modelGfx == null) { return null; } int frameNumber = -1; - if(projectileGFX.animationSequence != null) { + if (projectileGFX.animationSequence != null) { frameNumber = projectileGFX.animationSequence.primaryFrames[gfxStage]; } Model projectileModel = new Model(true, Frame.noAnimationInProgress(frameNumber), false, modelGfx); - if(frameNumber != -1) { + if (frameNumber != -1) { projectileModel.skin(); projectileModel.applyTransform(frameNumber); projectileModel.faceGroups = null; projectileModel.vertexGroups = null; } - if(projectileGFX.resizeXY != 128 || projectileGFX.resizeZ != 128) { + if (projectileGFX.resizeXY != 128 || projectileGFX.resizeZ != 128) { projectileModel.scale(projectileGFX.resizeXY, projectileGFX.resizeXY, projectileGFX.resizeZ); } projectileModel.leanOverX(tiltAngle); @@ -74,7 +77,8 @@ public Model getRotatedModel() { return projectileModel; } - public Projectile(int initialSlope, int endHeight, int creationCycle, int destructionCycle, int initialDistance, int startZ, int startHeight, int y, int x, int target, int gfxMoving) { + public Projectile(int initialSlope, int endHeight, int creationCycle, int destructionCycle, int initialDistance, + int startZ, int startHeight, int y, int x, int target, int gfxMoving) { projectileGFX = Graphic.cache[gfxMoving]; projectileZ = startZ; projectileX = x; @@ -91,18 +95,19 @@ public Projectile(int initialSlope, int endHeight, int creationCycle, int destru public void progressCycles(int cyclesMissed) { started = true; - xPos += xIncrement * (double)cyclesMissed; - yPos += yIncrement * (double)cyclesMissed; - cnterHeight += heightIncrement * (double)cyclesMissed + 0.5D * aDouble1578 * (double)cyclesMissed * (double)cyclesMissed; - heightIncrement += aDouble1578 * (double)cyclesMissed; - //noinspection SuspiciousNameCombination - turnValue = (int)(Math.atan2(xIncrement, yIncrement) * 325.94900000000001D) + 1024 & 0x7ff; - tiltAngle = (int)(Math.atan2(heightIncrement, diagonalIncrement) * 325.94900000000001D) & 0x7ff; - if(projectileGFX.animationSequence != null) { - for(gfxTickOfCurrentStage += cyclesMissed; gfxTickOfCurrentStage > projectileGFX.animationSequence.duration(gfxStage);) { + xPos += xIncrement * cyclesMissed; + yPos += yIncrement * cyclesMissed; + cnterHeight += heightIncrement * cyclesMissed + 0.5D * aDouble1578 * cyclesMissed * cyclesMissed; + heightIncrement += aDouble1578 * cyclesMissed; + // noinspection SuspiciousNameCombination + turnValue = (int) (Math.atan2(xIncrement, yIncrement) * 325.94900000000001D) + 1024 & 0x7ff; + tiltAngle = (int) (Math.atan2(heightIncrement, diagonalIncrement) * 325.94900000000001D) & 0x7ff; + if (projectileGFX.animationSequence != null) { + for (gfxTickOfCurrentStage += cyclesMissed; gfxTickOfCurrentStage > projectileGFX.animationSequence + .duration(gfxStage);) { gfxTickOfCurrentStage -= projectileGFX.animationSequence.duration(gfxStage) + 1; gfxStage++; - if(gfxStage >= projectileGFX.animationSequence.frameCount) { + if (gfxStage >= projectileGFX.animationSequence.frameCount) { gfxStage = 0; } } diff --git a/Elvarg - Client/src/com/runescape/scene/SceneGraph.java b/Elvarg - Client/src/com/runescape/scene/SceneGraph.java index 3406611..49165da 100644 --- a/Elvarg - Client/src/com/runescape/scene/SceneGraph.java +++ b/Elvarg - Client/src/com/runescape/scene/SceneGraph.java @@ -1,15 +1,16 @@ package com.runescape.scene; + import com.runescape.collection.Deque; import com.runescape.draw.Rasterizer2D; import com.runescape.draw.Rasterizer3D; +import com.runescape.entity.GameObject; import com.runescape.entity.GroundItemTile; import com.runescape.entity.Renderable; -import com.runescape.entity.GameObject; import com.runescape.entity.model.Model; import com.runescape.entity.model.VertexNormal; import com.runescape.scene.object.GroundDecoration; -import com.runescape.scene.object.WallObject; import com.runescape.scene.object.WallDecoration; +import com.runescape.scene.object.WallObject; import com.runescape.scene.object.tile.ShapedTile; import com.runescape.scene.object.tile.SimpleTile; import com.runescape.scene.object.tile.Tile; @@ -20,7 +21,7 @@ public SceneGraph(int heightMap[][][]) { int yLocSize = 104;// was parameter int xLocSize = 104;// was parameter int zLocSize = 4;// was parameter - gameObjectsCache = new GameObject[5000]; + gameObjectsCache = new GameObject[5000]; anIntArray486 = new int[10000]; anIntArray487 = new int[10000]; numberOfZ = zLocSize; @@ -32,9 +33,9 @@ public SceneGraph(int heightMap[][][]) { initToNull(); } - /** - * The class destructor. - */ + /** + * The class destructor. + */ public static void destructor() { interactableObjects = null; sceneClusterCounts = null; @@ -51,15 +52,15 @@ public void initToNull() { tileArray[zLoc][xLoc][yLoc] = null; for (int plane = 0; plane < cullingClusterPlaneCount; plane++) { for (int j1 = 0; j1 < sceneClusterCounts[plane]; j1++) - sceneClusters[plane][j1] = null; - sceneClusterCounts[plane] = 0; + sceneClusters[plane][j1] = null; + sceneClusterCounts[plane] = 0; } for (int i = 0; i < interactableObjectCacheCurrPos; i++) gameObjectsCache[i] = null; interactableObjectCacheCurrPos = 0; for (int i = 0; i < interactableObjects.length; i++) - interactableObjects[i] = null; + interactableObjects[i] = null; } @@ -91,7 +92,8 @@ public void applyBridgeMode(int yLoc, int xLoc) { tileArray[3][xLoc][yLoc] = null; } - public static void createNewSceneCluster(int z, int lowestX, int lowestZ, int highestX, int highestY, int highestZ, int lowestY, int searchMask) { + public static void createNewSceneCluster(int z, int lowestX, int lowestZ, int highestX, int highestY, int highestZ, + int lowestY, int searchMask) { SceneCluster sceneCluster = new SceneCluster(); sceneCluster.startXLoc = lowestX / 128; sceneCluster.endXLoc = highestX / 128; @@ -113,7 +115,8 @@ public void setTileLogicHeight(int zLoc, int xLoc, int yLoc, int logicHeight) { tileArray[zLoc][xLoc][yLoc].logicHeight = logicHeight; } - public void addTile(int zLoc, int xLoc, int yLoc, int shape, int i1, int j1, int k1, int l1, int i2, int j2, int k2, int l2, int i3, int j3, int k3, int l3, int i4, int j4, int k4, int l4) { + public void addTile(int zLoc, int xLoc, int yLoc, int shape, int i1, int j1, int k1, int l1, int i2, int j2, int k2, + int l2, int i3, int j3, int k3, int l3, int i4, int j4, int k4, int l4) { if (shape == 0) { SimpleTile simpleTile = new SimpleTile(k2, l2, i3, j3, -1, k4, false); for (int lowerZLoc = zLoc; lowerZLoc >= 0; lowerZLoc--) @@ -129,16 +132,18 @@ public void addTile(int zLoc, int xLoc, int yLoc, int shape, int i1, int j1, int tileArray[zLoc][xLoc][yLoc].mySimpleTile = simpleTile; } else { - ShapedTile shapedTile = new ShapedTile(yLoc, k3, j3, i2, j1, i4, i1, k2, k4, i3, j2, l1, k1, shape, j4, l3, l2, xLoc, l4); - for (int k5 = zLoc; k5 >= 0; k5--) - if (tileArray[k5][xLoc][yLoc] == null) - tileArray[k5][xLoc][yLoc] = new Tile(k5, xLoc, yLoc); + ShapedTile shapedTile = new ShapedTile(yLoc, k3, j3, i2, j1, i4, i1, k2, k4, i3, j2, l1, k1, shape, j4, l3, + l2, xLoc, l4); + for (int k5 = zLoc; k5 >= 0; k5--) + if (tileArray[k5][xLoc][yLoc] == null) + tileArray[k5][xLoc][yLoc] = new Tile(k5, xLoc, yLoc); - tileArray[zLoc][xLoc][yLoc].myShapedTile = shapedTile; - } + tileArray[zLoc][xLoc][yLoc].myShapedTile = shapedTile; + } } - public void addGroundDecoration(int zLoc, int zPos, int yLoc, Renderable renderable, byte objectRotationType, int uid, int xLoc) { + public void addGroundDecoration(int zLoc, int zPos, int yLoc, Renderable renderable, byte objectRotationType, + int uid, int xLoc) { if (renderable == null) return; GroundDecoration groundDecoration = new GroundDecoration(); @@ -153,7 +158,8 @@ public void addGroundDecoration(int zLoc, int zPos, int yLoc, Renderable rendera tileArray[zLoc][xLoc][yLoc].groundDecoration = groundDecoration; } - public void addGroundItemTile(int xLoc, int uid, Renderable firstNode, int zPos, Renderable secondNode, Renderable thirdNode, int zLoc, int yLoc) { + public void addGroundItemTile(int xLoc, int uid, Renderable firstNode, int zPos, Renderable secondNode, + Renderable thirdNode, int zLoc, int yLoc) { GroundItemTile groundItemTile = new GroundItemTile(); groundItemTile.topNode = thirdNode; groundItemTile.xPos = xLoc * 128 + 64; @@ -179,7 +185,8 @@ public void addGroundItemTile(int xLoc, int uid, Renderable firstNode, int zPos, tileArray[zLoc][xLoc][yLoc].groundItemTile = groundItemTile; } - public void addWallObject(int orientation1, Renderable renderable1, int uid, int yLoc, byte objectFaceType, int xLoc, Renderable renderable2, int zPos, int orientation2, int zLoc) { + public void addWallObject(int orientation1, Renderable renderable1, int uid, int yLoc, byte objectFaceType, + int xLoc, Renderable renderable2, int zPos, int orientation2, int zLoc) { if (renderable1 == null && renderable2 == null) return; WallObject wallObject = new WallObject(); @@ -199,7 +206,8 @@ public void addWallObject(int orientation1, Renderable renderable1, int uid, int tileArray[zLoc][xLoc][yLoc].wallObject = wallObject; } - public void addWallDecoration(int uid, int yLoc, int orientation2, int zLoc, int xOffset, int zPos, Renderable renderable, int xLoc, byte objectRotationType, int yOffset, int orientation) { + public void addWallDecoration(int uid, int yLoc, int orientation2, int zLoc, int xOffset, int zPos, + Renderable renderable, int xLoc, byte objectRotationType, int yOffset, int orientation) { if (renderable == null) return; WallDecoration wallDecoration = new WallDecoration(); @@ -218,17 +226,20 @@ public void addWallDecoration(int uid, int yLoc, int orientation2, int zLoc, int tileArray[zLoc][xLoc][yLoc].wallDecoration = wallDecoration; } - public boolean addTiledObject(int uid, byte objectRotationType, int tileHeight, int sizeY, Renderable renderable, int sizeX, int zLoc, int turnValue, int yLoc, int xLoc) { + public boolean addTiledObject(int uid, byte objectRotationType, int tileHeight, int sizeY, Renderable renderable, + int sizeX, int zLoc, int turnValue, int yLoc, int xLoc) { if (renderable == null) { return true; } else { int xPos = xLoc * 128 + 64 * sizeX; int yPos = yLoc * 128 + 64 * sizeY; - return addAnimableC(zLoc, xLoc, yLoc, sizeX, sizeY, xPos, yPos, tileHeight, renderable, turnValue, false, uid, objectRotationType); + return addAnimableC(zLoc, xLoc, yLoc, sizeX, sizeY, xPos, yPos, tileHeight, renderable, turnValue, false, + uid, objectRotationType); } } - public boolean addAnimableA(int zLoc, int turnValue, int k, int uid, int yPos, int halfSizePos, int xPos, Renderable animable, boolean flag) { + public boolean addAnimableA(int zLoc, int turnValue, int k, int uid, int yPos, int halfSizePos, int xPos, + Renderable animable, boolean flag) { if (animable == null) return true; int startXLoc = xPos - halfSizePos; @@ -245,18 +256,24 @@ public boolean addAnimableA(int zLoc, int turnValue, int k, int uid, int yPos, i if (turnValue > 128 && turnValue < 896) startXLoc -= 128; } - startXLoc /= 128; - startYLoc /= 128; + startXLoc /= 128; + startYLoc /= 128; endXLoc /= 128; - endYLoc /= 128; - return addAnimableC(zLoc, startXLoc, startYLoc, (endXLoc - startXLoc) + 1, (endYLoc - startYLoc) + 1, xPos, yPos, k, animable, turnValue, true, uid, (byte) 0); + endYLoc /= 128; + return addAnimableC(zLoc, startXLoc, startYLoc, (endXLoc - startXLoc) + 1, (endYLoc - startYLoc) + 1, xPos, + yPos, k, animable, turnValue, true, uid, (byte) 0); } - public boolean addToScenePlayerAsObject(int zLoc, int playerYPos, Renderable playerAsObject, int playerTurnValue, int objectEndYLoc, int playerXPos, int playerHeight, int objectStartXLoc, int objectEndXLoc, int uid, int objectStartYLoc) { - return playerAsObject == null || addAnimableC(zLoc, objectStartXLoc, objectStartYLoc, (objectEndXLoc - objectStartXLoc) + 1, (objectEndYLoc - objectStartYLoc) + 1, playerXPos, playerYPos, playerHeight, playerAsObject, playerTurnValue, true, uid, (byte) 0); + public boolean addToScenePlayerAsObject(int zLoc, int playerYPos, Renderable playerAsObject, int playerTurnValue, + int objectEndYLoc, int playerXPos, int playerHeight, int objectStartXLoc, int objectEndXLoc, int uid, + int objectStartYLoc) { + return playerAsObject == null || addAnimableC(zLoc, objectStartXLoc, objectStartYLoc, + (objectEndXLoc - objectStartXLoc) + 1, (objectEndYLoc - objectStartYLoc) + 1, playerXPos, playerYPos, + playerHeight, playerAsObject, playerTurnValue, true, uid, (byte) 0); } - private boolean addAnimableC(int zLoc, int xLoc, int yLoc, int sizeX, int sizeY, int xPos, int yPos, int tileHeight, Renderable renderable, int turnValue, boolean isDynamic, int uid, byte objectRotationType) { + private boolean addAnimableC(int zLoc, int xLoc, int yLoc, int sizeX, int sizeY, int xPos, int yPos, int tileHeight, + Renderable renderable, int turnValue, boolean isDynamic, int uid, byte objectRotationType) { for (int x = xLoc; x < xLoc + sizeX; x++) { for (int y = yLoc; y < yLoc + sizeY; y++) { if (x < 0 || y < 0 || x >= xRegionSize || y >= yRegionSize) @@ -308,7 +325,7 @@ private boolean addAnimableC(int zLoc, int xLoc, int yLoc, int sizeX, int sizeY, if (isDynamic) { gameObjectsCache[interactableObjectCacheCurrPos++] = gameObject; } - + return true; } @@ -348,7 +365,8 @@ private void remove(GameObject gameObject) { } } - public void method290(int yLoc, int k, int xLoc, int zLoc) { //TODO scale position? + public void method290(int yLoc, int k, int xLoc, int zLoc) { // TODO scale + // position? Tile tile = tileArray[zLoc][xLoc][yLoc]; if (tile == null) return; @@ -472,15 +490,21 @@ public int getGroundDecorationUid(int zLoc, int xLoc, int yLoc) { return tile.groundDecoration.uid; } - /** - * Retrieves the mask of the object with the given uid at the given location. - * -1 if there's no object. - * @param zLoc The zLoc. - * @param xLoc The xLoc. - * @param yLoc The yLoc. - * @param uid The object's Uid. - * @return The mask, which is comprised out of the rotation (shifted 6 to the left) and the type (which has a maximum value of 22). - */ + /** + * Retrieves the mask of the object with the given uid at the given + * location. -1 if there's no object. + * + * @param zLoc + * The zLoc. + * @param xLoc + * The xLoc. + * @param yLoc + * The yLoc. + * @param uid + * The object's Uid. + * @return The mask, which is comprised out of the rotation (shifted 6 to + * the left) and the type (which has a maximum value of 22). + */ public int getMask(int zLoc, int xLoc, int yLoc, int uid) { Tile tile = tileArray[zLoc][xLoc][yLoc]; if (tile == null) @@ -508,27 +532,36 @@ public void shadeModels(int lightY, int lightX, int lightZ) { Tile tile = tileArray[zLoc][xLoc][yLoc]; if (tile != null) { WallObject wallObject = tile.wallObject; - if (wallObject != null && wallObject.renderable1 != null && wallObject.renderable1.vertexNormals != null) { + if (wallObject != null && wallObject.renderable1 != null + && wallObject.renderable1.vertexNormals != null) { method307(zLoc, 1, 1, xLoc, yLoc, (Model) wallObject.renderable1); if (wallObject.renderable2 != null && wallObject.renderable2.vertexNormals != null) { method307(zLoc, 1, 1, xLoc, yLoc, (Model) wallObject.renderable2); - mergeNormals((Model) wallObject.renderable1, (Model) wallObject.renderable2, 0, 0, 0, false); - ((Model) wallObject.renderable2).doShading(intensity, someLightQualityVariable, lightX, lightY, lightZ); + mergeNormals((Model) wallObject.renderable1, (Model) wallObject.renderable2, 0, 0, 0, + false); + ((Model) wallObject.renderable2).doShading(intensity, someLightQualityVariable, lightX, + lightY, lightZ); } - ((Model) wallObject.renderable1).doShading(intensity, someLightQualityVariable, lightX, lightY, lightZ); + ((Model) wallObject.renderable1).doShading(intensity, someLightQualityVariable, lightX, + lightY, lightZ); } for (int k2 = 0; k2 < tile.gameObjectIndex; k2++) { GameObject interactableObject = tile.gameObjects[k2]; - if (interactableObject != null && interactableObject.renderable != null && interactableObject.renderable.vertexNormals != null) { - method307(zLoc, (interactableObject.xLocHigh - interactableObject.xLocLow) + 1, (interactableObject.yLocLow - interactableObject.yLocHigh) + 1, xLoc, yLoc, (Model) interactableObject.renderable); - ((Model) interactableObject.renderable).doShading(intensity, someLightQualityVariable, lightX, lightY, lightZ); + if (interactableObject != null && interactableObject.renderable != null + && interactableObject.renderable.vertexNormals != null) { + method307(zLoc, (interactableObject.xLocHigh - interactableObject.xLocLow) + 1, + (interactableObject.yLocLow - interactableObject.yLocHigh) + 1, xLoc, yLoc, + (Model) interactableObject.renderable); + ((Model) interactableObject.renderable).doShading(intensity, someLightQualityVariable, + lightX, lightY, lightZ); } } GroundDecoration groundDecoration = tile.groundDecoration; if (groundDecoration != null && groundDecoration.renderable.vertexNormals != null) { method306GroundDecorationOnly(xLoc, zLoc, (Model) groundDecoration.renderable, yLoc); - ((Model) groundDecoration.renderable).doShading(intensity, someLightQualityVariable, lightX, lightY, lightZ); + ((Model) groundDecoration.renderable).doShading(intensity, someLightQualityVariable, lightX, + lightY, lightZ); } } } @@ -536,7 +569,10 @@ public void shadeModels(int lightY, int lightX, int lightZ) { } } - private void method306GroundDecorationOnly(int modelXLoc, int modelZLoc, Model model, int modelYLoc) { //TODO figure it out + private void method306GroundDecorationOnly(int modelXLoc, int modelZLoc, Model model, int modelYLoc) { // TODO + // figure + // it + // out if (modelXLoc < xRegionSize) { Tile tile = tileArray[modelZLoc][modelXLoc + 1][modelYLoc]; if (tile != null && tile.groundDecoration != null && tile.groundDecoration.renderable.vertexNormals != null) @@ -566,31 +602,52 @@ private void method307(int modelZLoc, int modelXSize, int modelYSize, int modelX int startY = modelYLoc - 1; int stopY = modelYLoc + modelYSize; for (int zLoc = modelZLoc; zLoc <= modelZLoc + 1; zLoc++) - if (zLoc != numberOfZ) {//TODO Always? + if (zLoc != numberOfZ) {// TODO Always? for (int xLoc = startX; xLoc <= stopX; xLoc++) if (xLoc >= 0 && xLoc < xRegionSize) { for (int yLoc = startY; yLoc <= stopY; yLoc++) - if (yLoc >= 0 && yLoc < yRegionSize && (!flag || xLoc >= stopX || yLoc >= stopY || yLoc < modelYLoc && xLoc != modelXLoc)) { + if (yLoc >= 0 && yLoc < yRegionSize && (!flag || xLoc >= stopX || yLoc >= stopY + || yLoc < modelYLoc && xLoc != modelXLoc)) { Tile tile = tileArray[zLoc][xLoc][yLoc]; if (tile != null) { - int relativeHeightToModelTile = (heightMap[zLoc][xLoc][yLoc] + heightMap[zLoc][xLoc + 1][yLoc] + heightMap[zLoc][xLoc][yLoc + 1] + heightMap[zLoc][xLoc + 1][yLoc + 1]) / 4 - (heightMap[modelZLoc][modelXLoc][modelYLoc] + heightMap[modelZLoc][modelXLoc + 1][modelYLoc] + heightMap[modelZLoc][modelXLoc][modelYLoc + 1] + heightMap[modelZLoc][modelXLoc + 1][modelYLoc + 1]) / 4; + int relativeHeightToModelTile = (heightMap[zLoc][xLoc][yLoc] + + heightMap[zLoc][xLoc + 1][yLoc] + heightMap[zLoc][xLoc][yLoc + 1] + + heightMap[zLoc][xLoc + 1][yLoc + 1]) / 4 + - (heightMap[modelZLoc][modelXLoc][modelYLoc] + + heightMap[modelZLoc][modelXLoc + 1][modelYLoc] + + heightMap[modelZLoc][modelXLoc][modelYLoc + 1] + + heightMap[modelZLoc][modelXLoc + 1][modelYLoc + 1]) / 4; WallObject wallObject = tile.wallObject; - if (wallObject != null && wallObject.renderable1 != null && wallObject.renderable1.vertexNormals != null) - mergeNormals(model, (Model) wallObject.renderable1, (xLoc - modelXLoc) * 128 + (1 - modelXSize) * 64, relativeHeightToModelTile, (yLoc - modelYLoc) * 128 + (1 - modelYSize) * 64, flag); - if (wallObject != null && wallObject.renderable2 != null && wallObject.renderable2.vertexNormals != null) - mergeNormals(model, (Model) wallObject.renderable2, (xLoc - modelXLoc) * 128 + (1 - modelXSize) * 64, relativeHeightToModelTile, (yLoc - modelYLoc) * 128 + (1 - modelYSize) * 64, flag); + if (wallObject != null && wallObject.renderable1 != null + && wallObject.renderable1.vertexNormals != null) + mergeNormals(model, (Model) wallObject.renderable1, + (xLoc - modelXLoc) * 128 + (1 - modelXSize) * 64, + relativeHeightToModelTile, + (yLoc - modelYLoc) * 128 + (1 - modelYSize) * 64, flag); + if (wallObject != null && wallObject.renderable2 != null + && wallObject.renderable2.vertexNormals != null) + mergeNormals(model, (Model) wallObject.renderable2, + (xLoc - modelXLoc) * 128 + (1 - modelXSize) * 64, + relativeHeightToModelTile, + (yLoc - modelYLoc) * 128 + (1 - modelYSize) * 64, flag); for (int i = 0; i < tile.gameObjectIndex; i++) { GameObject gameObject = tile.gameObjects[i]; - if (gameObject != null && gameObject.renderable != null && gameObject.renderable.vertexNormals != null) { + if (gameObject != null && gameObject.renderable != null + && gameObject.renderable.vertexNormals != null) { int tiledObjectXSize = (gameObject.xLocHigh - gameObject.xLocLow) + 1; int tiledObjectYSize = (gameObject.yLocLow - gameObject.yLocHigh) + 1; - mergeNormals(model, (Model) gameObject.renderable, (gameObject.xLocLow - modelXLoc) * 128 + (tiledObjectXSize - modelXSize) * 64, relativeHeightToModelTile, (gameObject.yLocHigh - modelYLoc) * 128 + (tiledObjectYSize - modelYSize) * 64, flag); + mergeNormals(model, (Model) gameObject.renderable, + (gameObject.xLocLow - modelXLoc) * 128 + + (tiledObjectXSize - modelXSize) * 64, + relativeHeightToModelTile, (gameObject.yLocHigh - modelYLoc) * 128 + + (tiledObjectYSize - modelYSize) * 64, + flag); } } } } } - startX--; //TODO why? + startX--; // TODO why? flag = false; } @@ -602,7 +659,7 @@ private void mergeNormals(Model model1, Model model2, int offsetX, int offsetY, int second[] = model2.vertexX; int secondVertices = model2.numVertices; for (int model1Vertex = 0; model1Vertex < model1.numVertices; model1Vertex++) { - VertexNormal vertexNormal1 = model1.vertexNormals[model1Vertex]; + VertexNormal vertexNormal1 = model1.vertexNormals[model1Vertex]; VertexNormal alsoVertexNormal1 = model1.alsoVertexNormals[model1Vertex]; if (alsoVertexNormal1.magnitude != 0) { int dY = model1.vertexY[model1Vertex] - offsetY; @@ -614,7 +671,8 @@ private void mergeNormals(Model model1, Model model2, int offsetX, int offsetY, for (int l2 = 0; l2 < secondVertices; l2++) { VertexNormal vertexNormal2 = model2.vertexNormals[l2]; VertexNormal alsoVertexNormal2 = model2.alsoVertexNormals[l2]; - if (dX == second[l2] && k2 == model2.vertexZ[l2] && dY == model2.vertexY[l2] && alsoVertexNormal2.magnitude != 0) { + if (dX == second[l2] && k2 == model2.vertexZ[l2] && dY == model2.vertexY[l2] + && alsoVertexNormal2.magnitude != 0) { vertexNormal1.normalX += alsoVertexNormal2.normalX; vertexNormal1.normalY += alsoVertexNormal2.normalY; vertexNormal1.normalZ += alsoVertexNormal2.normalZ; @@ -638,11 +696,13 @@ private void mergeNormals(Model model1, Model model2, int offsetX, int offsetY, if (count < 3 || !flag) return; for (int k1 = 0; k1 < model1.numTriangles; k1++) - if (anIntArray486[model1.facePointA[k1]] == anInt488 && anIntArray486[model1.facePointB[k1]] == anInt488 && anIntArray486[model1.facePointC[k1]] == anInt488) + if (anIntArray486[model1.facePointA[k1]] == anInt488 && anIntArray486[model1.facePointB[k1]] == anInt488 + && anIntArray486[model1.facePointC[k1]] == anInt488) model1.faceDrawType[k1] = -1; for (int l1 = 0; l1 < model2.numTriangles; l1++) - if (anIntArray487[model2.facePointA[l1]] == anInt488 && anIntArray487[model2.facePointB[l1]] == anInt488 && anIntArray487[model2.facePointC[l1]] == anInt488) + if (anIntArray487[model2.facePointA[l1]] == anInt488 && anIntArray487[model2.facePointB[l1]] == anInt488 + && anIntArray487[model2.facePointC[l1]] == anInt488) model2.faceDrawType[l1] = -1; } @@ -667,11 +727,11 @@ public void drawTileOnMinimapSprite(int pixels[], int drawIndex, int zLoc, int x return; } ShapedTile shapedTile = tile.myShapedTile; - + if (shapedTile == null) { return; } - + int shape = shapedTile.shape; int rotation = shapedTile.rotation; int underlayRGB = shapedTile.colourRGB; @@ -706,16 +766,16 @@ public static void setupViewport(int i, int j, int viewportWidth, int viewportHe anInt495 = 0; anInt496 = 0; SceneGraph.viewportWidth = viewportWidth; - SceneGraph.viewportHeight = viewportHeight; + SceneGraph.viewportHeight = viewportHeight; viewportHalfWidth = viewportWidth / 2; viewportHalfHeight = viewportHeight / 2; boolean aflag[][][][] = new boolean[9][32][53][53]; for (int zAngle = 128; zAngle <= 384; zAngle += 32) { for (int xyAngle = 0; xyAngle < 2048; xyAngle += 64) { - camUpDownY = Model.SINE[zAngle]; - camUpDownX = Model.COSINE[zAngle]; - camLeftRightY = Model.SINE[xyAngle]; - camLeftRightX = Model.COSINE[xyAngle]; + camUpDownY = Model.SINE[zAngle]; + camUpDownX = Model.COSINE[zAngle]; + camLeftRightY = Model.SINE[xyAngle]; + camLeftRightX = Model.COSINE[xyAngle]; int angularZSegment = (zAngle - 128) / 32; int angularXYSegment = xyAngle / 64; for (int xRelativeToCamera = -26; xRelativeToCamera <= 26; xRelativeToCamera++) { @@ -729,7 +789,8 @@ public static void setupViewport(int i, int j, int viewportWidth, int viewportHe flag2 = true; break; } - aflag[angularZSegment][angularXYSegment][xRelativeToCamera + 25 + 1][yRelativeToCamera + 25 + 1] = flag2; + aflag[angularZSegment][angularXYSegment][xRelativeToCamera + 25 + 1][yRelativeToCamera + 25 + + 1] = flag2; } } } @@ -742,21 +803,26 @@ public static void setupViewport(int i, int j, int viewportWidth, int viewportHe boolean flag1 = false; label0: for (int l3 = -1; l3 <= 1; l3++) { for (int j4 = -1; j4 <= 1; j4++) { - if (aflag[angularZSegment][angularXYSegment][xRelativeToCamera + l3 + 25 + 1][yRelativeToCamera + j4 + 25 + 1]) + if (aflag[angularZSegment][angularXYSegment][xRelativeToCamera + l3 + 25 + + 1][yRelativeToCamera + j4 + 25 + 1]) flag1 = true; - else if (aflag[angularZSegment][(angularXYSegment + 1) % 31][xRelativeToCamera + l3 + 25 + 1][yRelativeToCamera + j4 + 25 + 1]) + else if (aflag[angularZSegment][(angularXYSegment + 1) % 31][xRelativeToCamera + l3 + 25 + + 1][yRelativeToCamera + j4 + 25 + 1]) flag1 = true; - else if (aflag[angularZSegment + 1][angularXYSegment][xRelativeToCamera + l3 + 25 + 1][yRelativeToCamera + j4 + 25 + 1]) { + else if (aflag[angularZSegment + 1][angularXYSegment][xRelativeToCamera + l3 + 25 + + 1][yRelativeToCamera + j4 + 25 + 1]) { flag1 = true; } else { - if (!aflag[angularZSegment + 1][(angularXYSegment + 1) % 31][xRelativeToCamera + l3 + 25 + 1][yRelativeToCamera + j4 + 25 + 1]) + if (!aflag[angularZSegment + 1][(angularXYSegment + 1) % 31][xRelativeToCamera + l3 + + 25 + 1][yRelativeToCamera + j4 + 25 + 1]) continue; flag1 = true; } break label0; } } - aBooleanArrayArrayArrayArray491[angularZSegment][angularXYSegment][xRelativeToCamera + 25][yRelativeToCamera + 25] = flag1; + aBooleanArrayArrayArrayArray491[angularZSegment][angularXYSegment][xRelativeToCamera + + 25][yRelativeToCamera + 25] = flag1; } } } @@ -775,11 +841,14 @@ private static boolean method311(int i, int j, int k) { return l1 >= anInt495 && l1 <= viewportWidth && i2 >= anInt496 && i2 <= viewportHeight; } - /** - * Clicks on the screen and requests recomputation of the clicked tile. - * @param clickY The click's Y-coordinate on the applet. - * @param clickX The click's X-coordinate on the applet. - */ + /** + * Clicks on the screen and requests recomputation of the clicked tile. + * + * @param clickY + * The click's Y-coordinate on the applet. + * @param clickX + * The click's X-coordinate on the applet. + */ public void clickTile(int clickY, int clickX) { clicked = true; clickScreenX = clickX; @@ -788,19 +857,26 @@ public void clickTile(int clickY, int clickX) { clickedTileY = -1; } - /** - * Renders the terrain. - * The coordinates use the WorldCoordinate Axes but the modelWorld coordinates. - * @param cameraXPos The cameraViewpoint's X-coordinate. - * @param cameraYPos The cameraViewpoint's Y-coordinate. - * @param camAngleXY The cameraAngle in the XY-plain. - * @param cameraZPos The cameraViewpoint's X-coordinate. - * @param planeZ The plain the camera's looking at. - * @param camAngleZ The cameraAngle on the Z-axis. - */ + /** + * Renders the terrain. The coordinates use the WorldCoordinate Axes but the + * modelWorld coordinates. + * + * @param cameraXPos + * The cameraViewpoint's X-coordinate. + * @param cameraYPos + * The cameraViewpoint's Y-coordinate. + * @param camAngleXY + * The cameraAngle in the XY-plain. + * @param cameraZPos + * The cameraViewpoint's X-coordinate. + * @param planeZ + * The plain the camera's looking at. + * @param camAngleZ + * The cameraAngle on the Z-axis. + */ public void render(int cameraXPos, int cameraYPos, int camAngleXY, int cameraZPos, int planeZ, int camAngleZ) { if (cameraXPos < 0) - cameraXPos = 0; + cameraXPos = 0; else if (cameraXPos >= xRegionSize * 128) cameraXPos = xRegionSize * 128 - 1; if (cameraYPos < 0) @@ -821,14 +897,14 @@ else if (cameraYPos >= yRegionSize * 128) currentRenderPlane = planeZ; cameraLowTileX = xCameraTile - 25; if (cameraLowTileX < 0) - cameraLowTileX = 0; - cameraLowTileY = yCameraTile - 25; + cameraLowTileX = 0; + cameraLowTileY = yCameraTile - 25; if (cameraLowTileY < 0) cameraLowTileY = 0; - cameraHighTileX = xCameraTile + 25; + cameraHighTileX = xCameraTile + 25; if (cameraHighTileX > xRegionSize) cameraHighTileX = xRegionSize; - cameraHighTileY = yCameraTile + 25; + cameraHighTileY = yCameraTile + 25; if (cameraHighTileY > yRegionSize) cameraHighTileY = yRegionSize; method319(); @@ -839,7 +915,9 @@ else if (cameraYPos >= yRegionSize * 128) for (int yLoc = cameraLowTileY; yLoc < cameraHighTileY; yLoc++) { Tile tile = planeTiles[xLoc][yLoc]; if (tile != null) - if (tile.logicHeight > planeZ || !aBooleanArrayArray492[(xLoc - xCameraTile) + 25][(yLoc - yCameraTile) + 25] && heightMap[zLoc][xLoc][yLoc] - cameraZPos < 2000) { + if (tile.logicHeight > planeZ + || !aBooleanArrayArray492[(xLoc - xCameraTile) + 25][(yLoc - yCameraTile) + 25] + && heightMap[zLoc][xLoc][yLoc] - cameraZPos < 2000) { tile.aBoolean1322 = false; tile.aBoolean1323 = false; tile.someTileMask = 0; @@ -995,11 +1073,11 @@ private void renderTileF(Tile tile, boolean flag) { Tile class30_sub3_7 = currentTile.firstFloorTile; if (class30_sub3_7.mySimpleTile != null) { if (!method320(0, i, j)) - method315(class30_sub3_7.mySimpleTile, 0, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, i, j); + method315(class30_sub3_7.mySimpleTile, 0, camUpDownY, camUpDownX, camLeftRightY, + camLeftRightX, i, j); } else if (class30_sub3_7.myShapedTile != null && !method320(0, i, j)) - method316(i, camUpDownY, camLeftRightY, - class30_sub3_7.myShapedTile, camUpDownX, j, - camLeftRightX); + method316(i, camUpDownY, camLeftRightY, class30_sub3_7.myShapedTile, camUpDownX, j, + camLeftRightX); WallObject class10 = class30_sub3_7.wallObject; if (class10 != null) class10.renderable1.renderAtPoint(0, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, @@ -1008,7 +1086,9 @@ private void renderTileF(Tile tile, boolean flag) { for (int i2 = 0; i2 < class30_sub3_7.gameObjectIndex; i2++) { GameObject class28 = class30_sub3_7.gameObjects[i2]; if (class28 != null) - class28.renderable.renderAtPoint(class28.turnValue, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, class28.xPos - xCameraPos, class28.tileHeight - zCameraPos, class28.yPos - yCameraPos, class28.uid); + class28.renderable.renderAtPoint(class28.turnValue, camUpDownY, camUpDownX, camLeftRightY, + camLeftRightX, class28.xPos - xCameraPos, class28.tileHeight - zCameraPos, + class28.yPos - yCameraPos, class28.uid); } } @@ -1016,12 +1096,12 @@ private void renderTileF(Tile tile, boolean flag) { if (currentTile.mySimpleTile != null) { if (!method320(l, i, j)) { flag1 = true; - method315(currentTile.mySimpleTile, l, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, i, j); + method315(currentTile.mySimpleTile, l, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, i, + j); } } else if (currentTile.myShapedTile != null && !method320(l, i, j)) { flag1 = true; - method316(i, camUpDownY, camLeftRightY, - currentTile.myShapedTile, camUpDownX, j, camLeftRightX); + method316(i, camUpDownY, camLeftRightY, currentTile.myShapedTile, camUpDownX, j, camLeftRightX); } int j1 = 0; int j2 = 0; @@ -1063,17 +1143,17 @@ else if (yCameraTile > j) } if ((class10_3.orientation1 & j2) != 0 && !method321(l, i, j, class10_3.orientation1)) class10_3.renderable1.renderAtPoint(0, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, - class10_3.xPos - xCameraPos, class10_3.zPos - zCameraPos, - class10_3.yPos - yCameraPos, class10_3.uid); + class10_3.xPos - xCameraPos, class10_3.zPos - zCameraPos, class10_3.yPos - yCameraPos, + class10_3.uid); if ((class10_3.orientation2 & j2) != 0 && !method321(l, i, j, class10_3.orientation2)) class10_3.renderable2.renderAtPoint(0, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, - class10_3.xPos - xCameraPos, class10_3.zPos - zCameraPos, - class10_3.yPos - yCameraPos, class10_3.uid); + class10_3.xPos - xCameraPos, class10_3.zPos - zCameraPos, class10_3.yPos - yCameraPos, + class10_3.uid); } if (class26_1 != null && !method322(l, i, j, class26_1.renderable.modelBaseY)) if ((class26_1.orientation & j2) != 0) - class26_1.renderable.renderAtPoint(class26_1.orientation2, camUpDownY, camUpDownX, camLeftRightY, - camLeftRightX, class26_1.xPos - xCameraPos, class26_1.zPos - zCameraPos, + class26_1.renderable.renderAtPoint(class26_1.orientation2, camUpDownY, camUpDownX, + camLeftRightY, camLeftRightX, class26_1.xPos - xCameraPos, class26_1.zPos - zCameraPos, class26_1.yPos - yCameraPos, class26_1.uid); else if ((class26_1.orientation & 0x300) != 0) { int j4 = class26_1.xPos - xCameraPos; @@ -1094,13 +1174,13 @@ else if ((class26_1.orientation & 0x300) != 0) { int i11 = j4 + anIntArray463[i8]; int k11 = k6 + anIntArray464[i8]; class26_1.renderable.renderAtPoint(i8 * 512 + 256, camUpDownY, camUpDownX, camLeftRightY, - camLeftRightX, i11, l5, k11, class26_1.uid); + camLeftRightX, i11, l5, k11, class26_1.uid); } if ((class26_1.orientation & 0x200) != 0 && k10 > k9) { int j11 = j4 + anIntArray465[i8]; int l11 = k6 + anIntArray466[i8]; class26_1.renderable.renderAtPoint(i8 * 512 + 1280 & 0x7ff, camUpDownY, camUpDownX, - camLeftRightY, camLeftRightX, j11, l5, l11, class26_1.uid); + camLeftRightY, camLeftRightX, j11, l5, l11, class26_1.uid); } } if (flag1) { @@ -1152,8 +1232,8 @@ else if ((class26_1.orientation & 0x300) != 0) { if (currentTile.someTileMask != 0) { boolean flag2 = true; for (int k1 = 0; k1 < currentTile.gameObjectIndex; k1++) { - if (currentTile.gameObjects[k1].anInt528 == anInt448 || (currentTile.tiledObjectMasks[k1] - & currentTile.someTileMask) != currentTile.anInt1326) + if (currentTile.gameObjects[k1].anInt528 == anInt448 + || (currentTile.tiledObjectMasks[k1] & currentTile.someTileMask) != currentTile.anInt1326) continue; flag2 = false; break; @@ -1163,8 +1243,8 @@ else if ((class26_1.orientation & 0x300) != 0) { WallObject class10_1 = currentTile.wallObject; if (!method321(l, i, j, class10_1.orientation1)) class10_1.renderable1.renderAtPoint(0, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, - class10_1.xPos - xCameraPos, class10_1.zPos - zCameraPos, - class10_1.yPos - yCameraPos, class10_1.uid); + class10_1.xPos - xCameraPos, class10_1.zPos - zCameraPos, class10_1.yPos - yCameraPos, + class10_1.uid); currentTile.someTileMask = 0; } } @@ -1239,11 +1319,11 @@ else if ((class26_1.orientation & 0x300) != 0) { break; GameObject class28_3 = interactableObjects[l3]; class28_3.anInt528 = anInt448; - if (!method323(l, class28_3.xLocLow, class28_3.xLocHigh, class28_3.yLocHigh, - class28_3.yLocLow, class28_3.renderable.modelBaseY)) - class28_3.renderable.renderAtPoint(class28_3.turnValue, camUpDownY, camUpDownX, camLeftRightY, - camLeftRightX, class28_3.xPos - xCameraPos, class28_3.tileHeight - zCameraPos, - class28_3.yPos - yCameraPos, class28_3.uid); + if (!method323(l, class28_3.xLocLow, class28_3.xLocHigh, class28_3.yLocHigh, class28_3.yLocLow, + class28_3.renderable.modelBaseY)) + class28_3.renderable.renderAtPoint(class28_3.turnValue, camUpDownY, camUpDownX, + camLeftRightY, camLeftRightX, class28_3.xPos - xCameraPos, + class28_3.tileHeight - zCameraPos, class28_3.yPos - yCameraPos, class28_3.uid); for (int k7 = class28_3.xLocLow; k7 <= class28_3.xLocHigh; k7++) { for (int l8 = class28_3.yLocHigh; l8 <= class28_3.yLocLow; l8++) { Tile class30_sub3_22 = aclass30_sub3[k7][l8]; @@ -1305,7 +1385,7 @@ else if ((k7 != i || l8 != j) && class30_sub3_22.aBoolean1323) if (class26 != null && !method322(l, i, j, class26.renderable.modelBaseY)) if ((class26.orientation & currentTile.anInt1328) != 0) class26.renderable.renderAtPoint(class26.orientation2, camUpDownY, camUpDownX, camLeftRightY, - camLeftRightX, class26.xPos - xCameraPos, class26.zPos - zCameraPos, + camLeftRightX, class26.xPos - xCameraPos, class26.zPos - zCameraPos, class26.yPos - yCameraPos, class26.uid); else if ((class26.orientation & 0x300) != 0) { int l2 = class26.xPos - xCameraPos; @@ -1326,13 +1406,13 @@ else if ((class26.orientation & 0x300) != 0) { int i9 = l2 + anIntArray463[k5]; int i10 = i4 + anIntArray464[k5]; class26.renderable.renderAtPoint(k5 * 512 + 256, camUpDownY, camUpDownX, camLeftRightY, - camLeftRightX, i9, j3, i10, class26.uid); + camLeftRightX, i9, j3, i10, class26.uid); } if ((class26.orientation & 0x200) != 0 && l7 <= j6) { int j9 = l2 + anIntArray465[k5]; int j10 = i4 + anIntArray466[k5]; class26.renderable.renderAtPoint(k5 * 512 + 1280 & 0x7ff, camUpDownY, camUpDownX, - camLeftRightY, camLeftRightX, j9, j3, j10, class26.uid); + camLeftRightY, camLeftRightX, j9, j3, j10, class26.uid); } } WallObject class10_2 = currentTile.wallObject; @@ -1340,13 +1420,13 @@ else if ((class26.orientation & 0x300) != 0) { if ((class10_2.orientation2 & currentTile.anInt1328) != 0 && !method321(l, i, j, class10_2.orientation2)) class10_2.renderable2.renderAtPoint(0, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, - class10_2.xPos - xCameraPos, class10_2.zPos - zCameraPos, - class10_2.yPos - yCameraPos, class10_2.uid); + class10_2.xPos - xCameraPos, class10_2.zPos - zCameraPos, class10_2.yPos - yCameraPos, + class10_2.uid); if ((class10_2.orientation1 & currentTile.anInt1328) != 0 && !method321(l, i, j, class10_2.orientation1)) class10_2.renderable1.renderAtPoint(0, camUpDownY, camUpDownX, camLeftRightY, camLeftRightX, - class10_2.xPos - xCameraPos, class10_2.zPos - zCameraPos, - class10_2.yPos - yCameraPos, class10_2.uid); + class10_2.xPos - xCameraPos, class10_2.zPos - zCameraPos, class10_2.yPos - yCameraPos, + class10_2.uid); } } if (k < numberOfZ - 1) { @@ -1432,43 +1512,55 @@ private void method315(SimpleTile simpleTile, int i, int j, int k, int l, int i1 int l6 = Rasterizer3D.originViewY + (k4 << viewDistance) / j3; Rasterizer3D.alpha = 0; if ((i6 - k6) * (l5 - l6) - (j6 - l6) * (k5 - k6) > 0) { - Rasterizer3D.textureOutOfDrawingBounds = i6 < 0 || k6 < 0 || k5 < 0 || i6 > Rasterizer2D.lastX || k6 > Rasterizer2D.lastX || k5 > Rasterizer2D.lastX; + Rasterizer3D.textureOutOfDrawingBounds = i6 < 0 || k6 < 0 || k5 < 0 || i6 > Rasterizer2D.lastX + || k6 > Rasterizer2D.lastX || k5 > Rasterizer2D.lastX; if (clicked && method318(clickScreenX, clickScreenY, j6, l6, l5, i6, k6, k5)) { clickedTileX = j1; clickedTileY = k1; } if (simpleTile.getTexture() == -1) { if (simpleTile.getCenterColor() != 0xbc614e) - Rasterizer3D.drawShadedTriangle(j6, l6, l5, i6, k6, k5, simpleTile.getCenterColor(), simpleTile.getEastColor(), simpleTile.getNorthColor(), k3, j3, j2); + Rasterizer3D.drawShadedTriangle(j6, l6, l5, i6, k6, k5, simpleTile.getCenterColor(), + simpleTile.getEastColor(), simpleTile.getNorthColor(), k3, j3, j2); } else if (!lowMem) { if (simpleTile.isFlat()) - Rasterizer3D.drawTexturedTriangle(j6, l6, l5, i6, k6, k5, simpleTile.getCenterColor(), simpleTile.getEastColor(), simpleTile.getNorthColor(), i2, i3, l1, l3, i4, k4, k2, j2, j3, simpleTile.getTexture(), k3, j3, j2); + Rasterizer3D.drawTexturedTriangle(j6, l6, l5, i6, k6, k5, simpleTile.getCenterColor(), + simpleTile.getEastColor(), simpleTile.getNorthColor(), i2, i3, l1, l3, i4, k4, k2, j2, j3, + simpleTile.getTexture(), k3, j3, j2); else - Rasterizer3D.drawTexturedTriangle(j6, l6, l5, i6, k6, k5, simpleTile.getCenterColor(), simpleTile.getEastColor(), simpleTile.getNorthColor(), l2, l1, i3, j4, k4, i4, k3, j3, j2, simpleTile.getTexture(), k3, j3, j2); - } else { - int textureColor = TEXTURE_COLORS[simpleTile.getTexture()]; - Rasterizer3D.drawShadedTriangle(j6, l6, l5, i6, k6, k5, light(textureColor, simpleTile.getCenterColor()), light(textureColor, simpleTile.getEastColor()), light(textureColor, simpleTile.getNorthColor()), k3, j3, j2); + Rasterizer3D.drawTexturedTriangle(j6, l6, l5, i6, k6, k5, simpleTile.getCenterColor(), + simpleTile.getEastColor(), simpleTile.getNorthColor(), l2, l1, i3, j4, k4, i4, k3, j3, j2, + simpleTile.getTexture(), k3, j3, j2); + } else { + int textureColor = TEXTURE_COLORS[simpleTile.getTexture()]; + Rasterizer3D.drawShadedTriangle(j6, l6, l5, i6, k6, k5, + light(textureColor, simpleTile.getCenterColor()), + light(textureColor, simpleTile.getEastColor()), light(textureColor, simpleTile.getNorthColor()), + k3, j3, j2); } } if ((i5 - k5) * (l6 - l5) - (j5 - l5) * (k6 - k5) > 0) { - Rasterizer3D.textureOutOfDrawingBounds = i5 < 0 || k5 < 0 || k6 < 0 || i5 > Rasterizer2D.lastX || k5 > Rasterizer2D.lastX || k6 > Rasterizer2D.lastX; + Rasterizer3D.textureOutOfDrawingBounds = i5 < 0 || k5 < 0 || k6 < 0 || i5 > Rasterizer2D.lastX + || k5 > Rasterizer2D.lastX || k6 > Rasterizer2D.lastX; if (clicked && method318(clickScreenX, clickScreenY, j5, l5, l6, i5, k5, k6)) { clickedTileX = j1; clickedTileY = k1; } if (simpleTile.getTexture() == -1) { if (simpleTile.getNorthEastColor() != 0xbc614e) { - Rasterizer3D.drawShadedTriangle(j5, l5, l6, i5, k5, k6, simpleTile.getNorthEastColor(), simpleTile.getNorthColor(), - simpleTile.getEastColor(), k2, j2, j3); + Rasterizer3D.drawShadedTriangle(j5, l5, l6, i5, k5, k6, simpleTile.getNorthEastColor(), + simpleTile.getNorthColor(), simpleTile.getEastColor(), k2, j2, j3); } } else { if (!lowMem) { - Rasterizer3D.drawTexturedTriangle(j5, l5, l6, i5, k5, k6, simpleTile.getNorthEastColor(), simpleTile.getNorthColor(), - simpleTile.getEastColor(), i2, i3, l1, l3, i4, k4, k2, j2, j3, simpleTile.getTexture(), k2, j2, j3); + Rasterizer3D.drawTexturedTriangle(j5, l5, l6, i5, k5, k6, simpleTile.getNorthEastColor(), + simpleTile.getNorthColor(), simpleTile.getEastColor(), i2, i3, l1, l3, i4, k4, k2, j2, j3, + simpleTile.getTexture(), k2, j2, j3); return; } int j7 = TEXTURE_COLORS[simpleTile.getTexture()]; - Rasterizer3D.drawShadedTriangle(j5, l5, l6, i5, k5, k6, light(j7, simpleTile.getNorthEastColor()), light(j7, simpleTile.getNorthColor()), light(j7, simpleTile.getEastColor()), k2, j2, j3); + Rasterizer3D.drawShadedTriangle(j5, l5, l6, i5, k5, k6, light(j7, simpleTile.getNorthEastColor()), + light(j7, simpleTile.getNorthColor()), light(j7, simpleTile.getEastColor()), k2, j2, j3); } } } @@ -1516,8 +1608,8 @@ private void method316(int i, int j, int k, ShapedTile class40, int l, int i1, i clickedTileX = i; clickedTileY = i1; } - Rasterizer3D.drawDepthTriangle(i4, j4, k4, l4, i5, j5, ShapedTile.depthPoint[l2], ShapedTile.depthPoint[j3], - ShapedTile.depthPoint[l3]); + Rasterizer3D.drawDepthTriangle(i4, j4, k4, l4, i5, j5, ShapedTile.depthPoint[l2], + ShapedTile.depthPoint[j3], ShapedTile.depthPoint[l3]); if (class40.anIntArray682 == null || class40.anIntArray682[j2] == -1) { if (class40.anIntArray676[j2] != 0xbc614e) Rasterizer3D.drawShadedTriangle(l4, i5, j5, i4, j4, k4, class40.anIntArray676[j2], @@ -1534,8 +1626,9 @@ private void method316(int i, int j, int k, ShapedTile class40, int l, int i1, i else Rasterizer3D.drawTexturedTriangle(l4, i5, j5, i4, j4, k4, class40.anIntArray676[j2], class40.anIntArray677[j2], class40.anIntArray678[j2], ShapedTile.anIntArray690[l2], - ShapedTile.anIntArray690[j3], ShapedTile.anIntArray690[l3], ShapedTile.anIntArray691[l2], - ShapedTile.anIntArray691[j3], ShapedTile.anIntArray691[l3], ShapedTile.anIntArray692[l2], + ShapedTile.anIntArray690[j3], ShapedTile.anIntArray690[l3], + ShapedTile.anIntArray691[l2], ShapedTile.anIntArray691[j3], + ShapedTile.anIntArray691[l3], ShapedTile.anIntArray692[l2], ShapedTile.anIntArray692[j3], ShapedTile.anIntArray692[l3], class40.anIntArray682[j2], ShapedTile.depthPoint[l2], ShapedTile.depthPoint[j3], ShapedTile.depthPoint[l3]); } else { @@ -1548,7 +1641,7 @@ private void method316(int i, int j, int k, ShapedTile class40, int l, int i1, i } } - private int light(int j, int k) { + private int light(int j, int k) { k = 127 - k; k = (k * (j & 0x7f)) / 160; if (k < 2) @@ -1579,7 +1672,7 @@ private void method319() { anInt475 = 0; for (int sceneIndex = 0; sceneIndex < sceneClusterCount; sceneIndex++) { SceneCluster sceneCluster = sceneClusters[sceneIndex]; - if (sceneCluster.orientation == 1) { //YZ-plane + if (sceneCluster.orientation == 1) { // YZ-plane int relativeX = (sceneCluster.startXLoc - xCameraTile) + 25; if (relativeX < 0 || relativeX > 50) continue; @@ -1613,7 +1706,7 @@ private void method319() { aClass47Array476[anInt475++] = sceneCluster; continue; } - if (sceneCluster.orientation == 2) { //XZ-plane + if (sceneCluster.orientation == 2) { // XZ-plane int relativeY = (sceneCluster.startYLoc - yCameraTile) + 25; if (relativeY < 0 || relativeY > 50) continue; @@ -1634,18 +1727,18 @@ private void method319() { int dYPos = yCameraPos - sceneCluster.startYPos; if (dYPos > 32) { sceneCluster.cullDirection = 3; - } else if (dYPos < -32){ + } else if (dYPos < -32) { sceneCluster.cullDirection = 4; dYPos = -dYPos; } else { - continue; - } + continue; + } sceneCluster.anInt799 = (sceneCluster.startXPos - xCameraPos << 8) / dYPos; sceneCluster.anInt800 = (sceneCluster.endXPos - xCameraPos << 8) / dYPos; sceneCluster.anInt803 = (sceneCluster.startZPos - zCameraPos << 8) / dYPos; sceneCluster.anInt804 = (sceneCluster.endZPos - zCameraPos << 8) / dYPos; aClass47Array476[anInt475++] = sceneCluster; - } else if (sceneCluster.orientation == 4) { //XY-plane + } else if (sceneCluster.orientation == 4) { // XY-plane int relativeZ = sceneCluster.startZPos - zCameraPos; if (relativeZ > 128) { int minRelativeY = (sceneCluster.startYLoc - yCameraTile) + 25; @@ -1695,7 +1788,10 @@ private boolean method320(int zLoc, int xLoc, int yLoc) { return true; int xPos = xLoc << 7; int yPos = yLoc << 7; - if (method324(xPos + 1, heightMap[zLoc][xLoc][yLoc], yPos + 1) && method324((xPos + 128) - 1, heightMap[zLoc][xLoc + 1][yLoc], yPos + 1) && method324((xPos + 128) - 1, heightMap[zLoc][xLoc + 1][yLoc + 1], (yPos + 128) - 1) && method324(xPos + 1, heightMap[zLoc][xLoc][yLoc + 1], (yPos + 128) - 1)) { + if (method324(xPos + 1, heightMap[zLoc][xLoc][yLoc], yPos + 1) + && method324((xPos + 128) - 1, heightMap[zLoc][xLoc + 1][yLoc], yPos + 1) + && method324((xPos + 128) - 1, heightMap[zLoc][xLoc + 1][yLoc + 1], (yPos + 128) - 1) + && method324(xPos + 1, heightMap[zLoc][xLoc][yLoc + 1], (yPos + 128) - 1)) { anIntArrayArrayArray445[zLoc][xLoc][yLoc] = anInt448; return true; } else { @@ -1786,7 +1882,7 @@ private boolean method321(int i, int j, int k, int l) { if (l == 128) { return method324(i1, i2, j1); } else { - System.out.println("Warning unsupported wall type"); //TODO + System.out.println("Warning unsupported wall type"); // TODO return true; } } @@ -1940,9 +2036,9 @@ private boolean method324(int i, int j, int k) { private static final int[] anIntArray482 = { 2, 0, 0, 2, 0, 0, 0, 4, 4 }; private static final int[] anIntArray483 = { 0, 4, 4, 8, 0, 0, 8, 0, 0 }; private static final int[] anIntArray484 = { 1, 1, 0, 0, 0, 8, 0, 0, 8 }; - private static final int[] TEXTURE_COLORS = { 41, 39248, 41, 4643, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 43086, - 41, 41, 41, 41, 41, 41, 41, 8602, 41, 28992, 41, 41, 41, 41, 41, 5056, 41, 41, 41, 7079, 41, 41, 41, 41, 41, - 41, 41, 41, 41, 41, 3131, 41, 41, 41 }; + private static final int[] TEXTURE_COLORS = { 41, 39248, 41, 4643, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 43086, 41, 41, 41, 41, 41, 41, 41, 8602, 41, 28992, 41, 41, 41, 41, 41, 5056, 41, 41, 41, 7079, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 3131, 41, 41, 41 }; private final int[] anIntArray486; private final int[] anIntArray487; private int anInt488; diff --git a/Elvarg - Client/src/com/runescape/scene/SceneObject.java b/Elvarg - Client/src/com/runescape/scene/SceneObject.java index a871eb2..a6713a7 100644 --- a/Elvarg - Client/src/com/runescape/scene/SceneObject.java +++ b/Elvarg - Client/src/com/runescape/scene/SceneObject.java @@ -1,4 +1,5 @@ package com.runescape.scene; + import com.runescape.Client; import com.runescape.cache.anim.Animation; import com.runescape.cache.config.VariableBits; @@ -7,7 +8,7 @@ import com.runescape.entity.model.Model; public final class SceneObject extends Renderable { - + private int anInt1599; private final int[] anIntArray1600; private final int anInt1601; @@ -45,6 +46,7 @@ private ObjectDefinition method457() { } } + @Override public Model getRotatedModel() { int j = -1; if (aAnimation_1607 != null) { @@ -93,8 +95,8 @@ public SceneObject(int i, int j, int k, int l, int i1, int j1, int k1, int l1, b anInt1599 = 0; anInt1608 = Client.tick; if (flag && aAnimation_1607.loopOffset != -1) { - anInt1599 = (int) (Math.random() * (double) aAnimation_1607.frameCount); - anInt1608 -= (int) (Math.random() * (double) aAnimation_1607.duration(anInt1599)); + anInt1599 = (int) (Math.random() * aAnimation_1607.frameCount); + anInt1608 -= (int) (Math.random() * aAnimation_1607.duration(anInt1599)); } } ObjectDefinition objectDef = ObjectDefinition.lookup(anInt1610); diff --git a/Elvarg - Client/src/com/runescape/scene/object/GroundDecoration.java b/Elvarg - Client/src/com/runescape/scene/object/GroundDecoration.java index 1a6bed8..e0ed87c 100644 --- a/Elvarg - Client/src/com/runescape/scene/object/GroundDecoration.java +++ b/Elvarg - Client/src/com/runescape/scene/object/GroundDecoration.java @@ -1,11 +1,10 @@ package com.runescape.scene.object; + import com.runescape.entity.Renderable; -public final class GroundDecoration -{ +public final class GroundDecoration { - public GroundDecoration() - { + public GroundDecoration() { } public int zPos; diff --git a/Elvarg - Client/src/com/runescape/scene/object/SpawnedObject.java b/Elvarg - Client/src/com/runescape/scene/object/SpawnedObject.java index 2acbec7..41a2841 100644 --- a/Elvarg - Client/src/com/runescape/scene/object/SpawnedObject.java +++ b/Elvarg - Client/src/com/runescape/scene/object/SpawnedObject.java @@ -1,10 +1,10 @@ package com.runescape.scene.object; + import com.runescape.collection.Linkable; public final class SpawnedObject extends Linkable { - public SpawnedObject() - { + public SpawnedObject() { getLongetivity = -1; } diff --git a/Elvarg - Client/src/com/runescape/scene/object/WallObject.java b/Elvarg - Client/src/com/runescape/scene/object/WallObject.java index b289bec..32bd836 100644 --- a/Elvarg - Client/src/com/runescape/scene/object/WallObject.java +++ b/Elvarg - Client/src/com/runescape/scene/object/WallObject.java @@ -3,7 +3,7 @@ import com.runescape.entity.Renderable; public final class WallObject { - + public int zPos; public int xPos; public int yPos; @@ -13,5 +13,5 @@ public final class WallObject { public Renderable renderable2; public int uid; public byte mask; - + } diff --git a/Elvarg - Client/src/com/runescape/scene/object/tile/ShapedTile.java b/Elvarg - Client/src/com/runescape/scene/object/tile/ShapedTile.java index 84fd41a..fd57487 100644 --- a/Elvarg - Client/src/com/runescape/scene/object/tile/ShapedTile.java +++ b/Elvarg - Client/src/com/runescape/scene/object/tile/ShapedTile.java @@ -1,8 +1,9 @@ package com.runescape.scene.object.tile; -public final class ShapedTile{ - public ShapedTile(int yLoc, int j, int k, int l, int texture, int j1, int rotation, int l1, int i2, int j2, int k2, int l2, int i3, int j3, int k3, int l3, int i4, int xLoc, int l4){ - flat = !(i3 != l2 || i3 != l || i3 != k2); +public final class ShapedTile { + public ShapedTile(int yLoc, int j, int k, int l, int texture, int j1, int rotation, int l1, int i2, int j2, int k2, + int l2, int i3, int j3, int k3, int l3, int i4, int xLoc, int l4) { + flat = !(i3 != l2 || i3 != l || i3 != k2); shape = j3; this.rotation = rotation; colourRGB = i2; @@ -20,104 +21,104 @@ public ShapedTile(int yLoc, int j, int k, int l, int texture, int j1, int rotati int ai2[] = new int[l5]; int xPos = xLoc * sideLength; int yPos = yLoc * sideLength; - for(int k6 = 0; k6 < l5; k6++){ + for (int k6 = 0; k6 < l5; k6++) { int realShape = ai[k6]; - if((realShape & 1) == 0 && realShape <= 8) + if ((realShape & 1) == 0 && realShape <= 8) realShape = (realShape - rotation - rotation - 1 & 7) + 1; - if(realShape > 8 && realShape <= 12) + if (realShape > 8 && realShape <= 12) realShape = (realShape - 9 - rotation & 3) + 9; - if(realShape > 12 && realShape <= 16) + if (realShape > 12 && realShape <= 16) realShape = (realShape - 13 - rotation & 3) + 13; int i7; int k7; int i8; int k8; int j9; - if(realShape == 1){ + if (realShape == 1) { i7 = xPos; k7 = yPos; i8 = i3; k8 = l1; j9 = j; - } else if(realShape == 2){ + } else if (realShape == 2) { i7 = xPos + halfSizeLength; k7 = yPos; i8 = i3 + l2 >> 1; k8 = l1 + i4 >> 1; j9 = j + l3 >> 1; - } else if(realShape == 3){ + } else if (realShape == 3) { i7 = xPos + sideLength; k7 = yPos; i8 = l2; k8 = i4; j9 = l3; - } else if(realShape == 4){ + } else if (realShape == 4) { i7 = xPos + sideLength; k7 = yPos + halfSizeLength; i8 = l2 + l >> 1; k8 = i4 + j2 >> 1; j9 = l3 + j1 >> 1; - } else if(realShape == 5){ + } else if (realShape == 5) { i7 = xPos + sideLength; k7 = yPos + sideLength; i8 = l; k8 = j2; j9 = j1; - } else if(realShape == 6){ + } else if (realShape == 6) { i7 = xPos + halfSizeLength; k7 = yPos + sideLength; i8 = l + k2 >> 1; k8 = j2 + k >> 1; j9 = j1 + k3 >> 1; - } else if(realShape == 7){ + } else if (realShape == 7) { i7 = xPos; k7 = yPos + sideLength; i8 = k2; k8 = k; j9 = k3; - } else if(realShape == 8){ + } else if (realShape == 8) { i7 = xPos; k7 = yPos + halfSizeLength; i8 = k2 + i3 >> 1; k8 = k + l1 >> 1; j9 = k3 + j >> 1; - } else if(realShape == 9){ + } else if (realShape == 9) { i7 = xPos + halfSizeLength; k7 = yPos + quarterSizeLight; i8 = i3 + l2 >> 1; k8 = l1 + i4 >> 1; j9 = j + l3 >> 1; - } else if(realShape == 10){ + } else if (realShape == 10) { i7 = xPos + k5; k7 = yPos + halfSizeLength; i8 = l2 + l >> 1; k8 = i4 + j2 >> 1; j9 = l3 + j1 >> 1; - } else if(realShape == 11){ + } else if (realShape == 11) { i7 = xPos + halfSizeLength; k7 = yPos + k5; i8 = l + k2 >> 1; k8 = j2 + k >> 1; j9 = j1 + k3 >> 1; - } else if(realShape == 12){ + } else if (realShape == 12) { i7 = xPos + quarterSizeLight; k7 = yPos + halfSizeLength; i8 = k2 + i3 >> 1; k8 = k + l1 >> 1; j9 = k3 + j >> 1; - } else if(realShape == 13){ + } else if (realShape == 13) { i7 = xPos + quarterSizeLight; k7 = yPos + quarterSizeLight; i8 = i3; k8 = l1; j9 = j; - } else if(realShape == 14){ + } else if (realShape == 14) { i7 = xPos + k5; k7 = yPos + quarterSizeLight; i8 = l2; k8 = i4; j9 = l3; - } else if(realShape == 15){ + } else if (realShape == 15) { i7 = xPos + k5; k7 = yPos + k5; i8 = l; @@ -145,52 +146,52 @@ public ShapedTile(int yLoc, int j, int k, int l, int texture, int j1, int rotati anIntArray676 = new int[j7]; anIntArray677 = new int[j7]; anIntArray678 = new int[j7]; - if(texture != -1) + if (texture != -1) anIntArray682 = new int[j7]; int l7 = 0; - for(int j8 = 0; j8 < j7; j8++){ + for (int j8 = 0; j8 < j7; j8++) { int l8 = ai3[l7]; int k9 = ai3[l7 + 1]; int i10 = ai3[l7 + 2]; int k10 = ai3[l7 + 3]; l7 += 4; - if(k9 < 4) + if (k9 < 4) k9 = k9 - rotation & 3; - if(i10 < 4) + if (i10 < 4) i10 = i10 - rotation & 3; - if(k10 < 4) + if (k10 < 4) k10 = k10 - rotation & 3; anIntArray679[j8] = k9; anIntArray680[j8] = i10; anIntArray681[j8] = k10; - if(l8 == 0){ + if (l8 == 0) { anIntArray676[j8] = ai1[k9]; anIntArray677[j8] = ai1[i10]; anIntArray678[j8] = ai1[k10]; - if(anIntArray682 != null) + if (anIntArray682 != null) anIntArray682[j8] = -1; } else { anIntArray676[j8] = ai2[k9]; anIntArray677[j8] = ai2[i10]; anIntArray678[j8] = ai2[k10]; - if(anIntArray682 != null) + if (anIntArray682 != null) anIntArray682[j8] = texture; } } int i9 = i3; int l9 = l2; - if(l2 < i9) + if (l2 < i9) i9 = l2; - if(l2 > l9) + if (l2 > l9) l9 = l2; - if(l < i9) + if (l < i9) i9 = l; - if(l > l9) + if (l > l9) l9 = l; - if(k2 < i9) + if (k2 < i9) i9 = k2; - if(k2 > l9) + if (k2 > l9) l9 = k2; i9 /= 14; l9 /= 14; @@ -217,85 +218,20 @@ public ShapedTile(int yLoc, int j, int k, int l, int texture, int j1, int rotati public static final int[] anIntArray691 = new int[6]; public static final int[] anIntArray692 = new int[6]; public static final int[] depthPoint = new int[6]; - static final int[] anIntArray693 = { - 1, 0 - }; - static final int[] anIntArray694 = { - 2, 1 - }; - static final int[] anIntArray695 = { - 3, 3 - }; - private static final int[][] anIntArrayArray696 = { - { - 1, 3, 5, 7 - }, { - 1, 3, 5, 7 - }, { - 1, 3, 5, 7 - }, { - 1, 3, 5, 7, 6 - }, { - 1, 3, 5, 7, 6 - }, { - 1, 3, 5, 7, 6 - }, { - 1, 3, 5, 7, 6 - }, { - 1, 3, 5, 7, 2, 6 - }, { - 1, 3, 5, 7, 2, 8 - }, { - 1, 3, 5, 7, 2, 8 - }, { - 1, 3, 5, 7, 11, 12 - }, { - 1, 3, 5, 7, 11, 12 - }, { - 1, 3, 5, 7, 13, 14 - } - }; - private static final int[][] anIntArrayArray697 = { - { - 0, 1, 2, 3, 0, 0, 1, 3 - }, { - 1, 1, 2, 3, 1, 0, 1, 3 - }, { - 0, 1, 2, 3, 1, 0, 1, 3 - }, { - 0, 0, 1, 2, 0, 0, 2, 4, 1, 0, - 4, 3 - }, { - 0, 0, 1, 4, 0, 0, 4, 3, 1, 1, - 2, 4 - }, { - 0, 0, 4, 3, 1, 0, 1, 2, 1, 0, - 2, 4 - }, { - 0, 1, 2, 4, 1, 0, 1, 4, 1, 0, - 4, 3 - }, { - 0, 4, 1, 2, 0, 4, 2, 5, 1, 0, - 4, 5, 1, 0, 5, 3 - }, { - 0, 4, 1, 2, 0, 4, 2, 3, 0, 4, - 3, 5, 1, 0, 4, 5 - }, { - 0, 0, 4, 5, 1, 4, 1, 2, 1, 4, - 2, 3, 1, 4, 3, 5 - }, { - 0, 0, 1, 5, 0, 1, 4, 5, 0, 1, - 2, 4, 1, 0, 5, 3, 1, 5, 4, 3, - 1, 4, 2, 3 - }, { - 1, 0, 1, 5, 1, 1, 4, 5, 1, 1, - 2, 4, 0, 0, 5, 3, 0, 5, 4, 3, - 0, 4, 2, 3 - }, { - 1, 0, 5, 4, 1, 0, 1, 5, 0, 0, - 4, 3, 0, 4, 5, 3, 0, 5, 2, 3, - 0, 1, 2, 5 - } - }; + static final int[] anIntArray693 = { 1, 0 }; + static final int[] anIntArray694 = { 2, 1 }; + static final int[] anIntArray695 = { 3, 3 }; + private static final int[][] anIntArrayArray696 = { { 1, 3, 5, 7 }, { 1, 3, 5, 7 }, { 1, 3, 5, 7 }, + { 1, 3, 5, 7, 6 }, { 1, 3, 5, 7, 6 }, { 1, 3, 5, 7, 6 }, { 1, 3, 5, 7, 6 }, { 1, 3, 5, 7, 2, 6 }, + { 1, 3, 5, 7, 2, 8 }, { 1, 3, 5, 7, 2, 8 }, { 1, 3, 5, 7, 11, 12 }, { 1, 3, 5, 7, 11, 12 }, + { 1, 3, 5, 7, 13, 14 } }; + private static final int[][] anIntArrayArray697 = { { 0, 1, 2, 3, 0, 0, 1, 3 }, { 1, 1, 2, 3, 1, 0, 1, 3 }, + { 0, 1, 2, 3, 1, 0, 1, 3 }, { 0, 0, 1, 2, 0, 0, 2, 4, 1, 0, 4, 3 }, { 0, 0, 1, 4, 0, 0, 4, 3, 1, 1, 2, 4 }, + { 0, 0, 4, 3, 1, 0, 1, 2, 1, 0, 2, 4 }, { 0, 1, 2, 4, 1, 0, 1, 4, 1, 0, 4, 3 }, + { 0, 4, 1, 2, 0, 4, 2, 5, 1, 0, 4, 5, 1, 0, 5, 3 }, { 0, 4, 1, 2, 0, 4, 2, 3, 0, 4, 3, 5, 1, 0, 4, 5 }, + { 0, 0, 4, 5, 1, 4, 1, 2, 1, 4, 2, 3, 1, 4, 3, 5 }, + { 0, 0, 1, 5, 0, 1, 4, 5, 0, 1, 2, 4, 1, 0, 5, 3, 1, 5, 4, 3, 1, 4, 2, 3 }, + { 1, 0, 1, 5, 1, 1, 4, 5, 1, 1, 2, 4, 0, 0, 5, 3, 0, 5, 4, 3, 0, 4, 2, 3 }, + { 1, 0, 5, 4, 1, 0, 1, 5, 0, 0, 4, 3, 0, 4, 5, 3, 0, 5, 2, 3, 0, 1, 2, 5 } }; } diff --git a/Elvarg - Client/src/com/runescape/scene/object/tile/SimpleTile.java b/Elvarg - Client/src/com/runescape/scene/object/tile/SimpleTile.java index 04527e8..5ed92ce 100644 --- a/Elvarg - Client/src/com/runescape/scene/object/tile/SimpleTile.java +++ b/Elvarg - Client/src/com/runescape/scene/object/tile/SimpleTile.java @@ -1,23 +1,24 @@ package com.runescape.scene.object.tile; public final class SimpleTile { - - private final int northEastColor; - private final int northColor; - private final int centerColor; - private final int eastColor; - private final int texture; + + private final int northEastColor; + private final int northColor; + private final int centerColor; + private final int eastColor; + private final int texture; private final boolean flat; private final int colorRGB; - public SimpleTile(int northEastColor, int northColor, int centerColor, int eastColor, int texture, int colorRGB, boolean flat) { - this.northEastColor = northEastColor; - this.northColor = northColor; - this.centerColor = centerColor; - this.eastColor = eastColor; - this.texture = texture; - this.colorRGB = colorRGB; - this.flat = flat; + public SimpleTile(int northEastColor, int northColor, int centerColor, int eastColor, int texture, int colorRGB, + boolean flat) { + this.northEastColor = northEastColor; + this.northColor = northColor; + this.centerColor = centerColor; + this.eastColor = eastColor; + this.texture = texture; + this.colorRGB = colorRGB; + this.flat = flat; } public int getNorthEastColor() { @@ -32,11 +33,11 @@ public int getCenterColor() { return centerColor; } - public int getEastColor() { + public int getEastColor() { return eastColor; } - public int getTexture() { + public int getTexture() { return texture; } @@ -47,5 +48,5 @@ public boolean isFlat() { public int getColourRGB() { return colorRGB; } - + } diff --git a/Elvarg - Client/src/com/runescape/scene/object/tile/Tile.java b/Elvarg - Client/src/com/runescape/scene/object/tile/Tile.java index 7d93e0a..1a627aa 100644 --- a/Elvarg - Client/src/com/runescape/scene/object/tile/Tile.java +++ b/Elvarg - Client/src/com/runescape/scene/object/tile/Tile.java @@ -1,15 +1,16 @@ package com.runescape.scene.object.tile; + import com.runescape.collection.Linkable; +import com.runescape.entity.GameObject; import com.runescape.entity.GroundItemTile; import com.runescape.scene.object.GroundDecoration; -import com.runescape.scene.object.WallObject; import com.runescape.scene.object.WallDecoration; -import com.runescape.entity.GameObject; +import com.runescape.scene.object.WallObject; public final class Tile extends Linkable { - public Tile(int i, int j, int k){ + public Tile(int i, int j, int k) { gameObjects = new GameObject[5]; - tiledObjectMasks = new int[5]; + tiledObjectMasks = new int[5]; anInt1310 = z1AnInt1307 = i; anInt1308 = j; anInt1309 = k; diff --git a/Elvarg - Client/src/com/runescape/sign/SignLink.java b/Elvarg - Client/src/com/runescape/sign/SignLink.java index 3d217b7..5fbf519 100644 --- a/Elvarg - Client/src/com/runescape/sign/SignLink.java +++ b/Elvarg - Client/src/com/runescape/sign/SignLink.java @@ -87,6 +87,7 @@ public static void startpriv(InetAddress inetaddress) { } } + @Override public void run() { active = true; String directory = findcachedir(); @@ -94,11 +95,9 @@ public void run() { cache_dat = new RandomAccessFile(directory + "main_file_cache.dat", "rw"); for (int index = 0; index < 5; index++) { - indices[index] = new RandomAccessFile(directory + "main_file_cache.idx" - + index, "rw"); + indices[index] = new RandomAccessFile(directory + "main_file_cache.idx" + index, "rw"); } - } catch (Exception exception) { exception.printStackTrace(); } @@ -126,8 +125,7 @@ public void run() { } else if (savereq != null) { if (savebuf != null) try { - FileOutputStream fileoutputstream = new FileOutputStream( - directory + savereq); + FileOutputStream fileoutputstream = new FileOutputStream(directory + savereq); fileoutputstream.write(savebuf, 0, savelen); fileoutputstream.close(); } catch (Exception _ex) { @@ -137,8 +135,7 @@ public void run() { waveplay = false; AudioInputStream audioInputStream = null; try { - audioInputStream = AudioSystem - .getAudioInputStream(new File(wave)); + audioInputStream = AudioSystem.getAudioInputStream(new File(wave)); } catch (UnsupportedAudioFileException e1) { e1.printStackTrace(); return; @@ -148,8 +145,7 @@ public void run() { } AudioFormat format = audioInputStream.getFormat(); SourceDataLine auline = null; - DataLine.Info info = new DataLine.Info( - SourceDataLine.class, format); + DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); try { auline = (SourceDataLine) AudioSystem.getLine(info); auline.open(format); @@ -179,8 +175,7 @@ public void run() { } else if (urlRequest != null) { try { System.out.println("urlstream"); - urlStream = new DataInputStream((new URL( - mainapp.getCodeBase(), urlRequest)).openStream()); + urlStream = new DataInputStream((new URL(mainapp.getCodeBase(), urlRequest)).openStream()); } catch (Exception _ex) { urlStream = null; } @@ -204,23 +199,22 @@ public static String findcachedir() { final File cacheDirectory = new File(Configuration.CACHE_DIRECTORY); if (!cacheDirectory.exists()) { - if(!localDirectory.exists()) { + if (!localDirectory.exists()) { localDirectory.mkdir(); } return local; } // windows - if (os.indexOf("win") >= 0) { - return cacheLoc; + if (os.indexOf("win") >= 0) { + return cacheLoc; // macintosh - } else if (os.indexOf("mac") >= 0) { + } else if (os.indexOf("mac") >= 0) { return cacheLoc; // linux - } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 - || os.indexOf("aix") > 0) { + } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os.indexOf("aix") > 0) { return cacheLoc; // solaris @@ -258,11 +252,9 @@ private void playMidi(String location) { synthesizer = MidiSystem.getSynthesizer(); synthesizer.open(); if (synthesizer.getDefaultSoundbank() == null) { - music.getTransmitter() - .setReceiver(MidiSystem.getReceiver()); + music.getTransmitter().setReceiver(MidiSystem.getReceiver()); } else { - music.getTransmitter().setReceiver( - synthesizer.getReceiver()); + music.getTransmitter().setReceiver(synthesizer.getReceiver()); } } catch (Exception e) { e.printStackTrace(); @@ -285,10 +277,8 @@ public static void setVolume(int value) { try { ShortMessage volumeMessage = new ShortMessage(); for (int i = 0; i < 16; i++) { - volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, - CHANGE_VOLUME, midiVolume); - volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, - 39, midiVolume); + volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, CHANGE_VOLUME, midiVolume); + volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, 39, midiVolume); MidiSystem.getReceiver().send(volumeMessage, -1); } } catch (Exception e) { @@ -358,8 +348,7 @@ public static synchronized Socket openSocket(int port) throws IOException { return socket; } - public static synchronized DataInputStream openUrl(String url) - throws IOException { + public static synchronized DataInputStream openUrl(String url) throws IOException { for (urlRequest = url; urlRequest != null;) { try { Thread.sleep(50L); @@ -410,8 +399,7 @@ public static synchronized boolean wavereplay() { } public static String indexLocation(int cacheIndex, int index) { - return SignLink.findcachedir() + "index" + cacheIndex + "/" - + (index != -1 ? index + ".gz" : ""); + return SignLink.findcachedir() + "index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : ""); } public static void reporterror(String s) { diff --git a/Elvarg - Client/src/com/runescape/sound/Envelope.java b/Elvarg - Client/src/com/runescape/sound/Envelope.java index 52295c6..96c3d36 100644 --- a/Elvarg - Client/src/com/runescape/sound/Envelope.java +++ b/Elvarg - Client/src/com/runescape/sound/Envelope.java @@ -4,8 +4,7 @@ /** * A simple envelope generator to control a variety of parameters (such as - * attack and release). - * Refactored using Major's 317 refactored client + * attack and release). Refactored using Major's 317 refactored client * http://www.rune-server.org/runescape-development/rs2-client/downloads/575183-almost-fully-refactored-317-client.html */ final class Envelope { @@ -69,10 +68,9 @@ int step(int period) { amplitude = peaks[segmentIndex++] << 15; if (segmentIndex >= segments) segmentIndex = segments - 1; - threshold = (int) (((double) durations[segmentIndex] / 65536D) * (double) period); + threshold = (int) ((durations[segmentIndex] / 65536D) * period); if (threshold > ticks) - step = ((peaks[segmentIndex] << 15) - amplitude) - / (threshold - ticks); + step = ((peaks[segmentIndex] << 15) - amplitude) / (threshold - ticks); } amplitude += step; ticks++; diff --git a/Elvarg - Client/src/com/runescape/sound/Filter.java b/Elvarg - Client/src/com/runescape/sound/Filter.java index a2e3229..b562de0 100644 --- a/Elvarg - Client/src/com/runescape/sound/Filter.java +++ b/Elvarg - Client/src/com/runescape/sound/Filter.java @@ -3,10 +3,10 @@ import com.runescape.io.Buffer; /** - * an implementation of a reconfigurable filter that calculates - * coefficients from pole magnitude/phases and a serial - * configuration of cascading second-order iir filters - * Refactored information from Major's 317 refactored client + * an implementation of a reconfigurable filter that calculates coefficients + * from pole magnitude/phases and a serial configuration of cascading + * second-order iir filters Refactored information from Major's 317 refactored + * client * http://www.rune-server.org/runescape-development/rs2-client/downloads/575183-almost-fully-refactored-317-client.html */ final class Filter { @@ -28,17 +28,22 @@ public Filter() { } /** - * Perform precise linear interpolation on the magnitude (where "precise" means that the result is guaranteed to be - * the first magnitude ({@code magnitudes[direction][1][pair]}) when the step is {@code 1}). + * Perform precise linear interpolation on the magnitude (where "precise" + * means that the result is guaranteed to be the first magnitude + * ({@code magnitudes[direction][1][pair]}) when the step is {@code 1}). * - * @param direction The direction, where {@code 0} is feedforward, and {@code 1} is feedback. - * @param pair The pair. - * @param step The step (the interpolation parameter). + * @param direction + * The direction, where {@code 0} is feedforward, and {@code 1} + * is feedback. + * @param pair + * The pair. + * @param step + * The step (the interpolation parameter). * @return The interpolated magnitude. */ private float interpolateMagnitude(int direction, int pair, float step) { - float magnitude = (float) magnitudes[direction][0][pair] + step - * (float) (magnitudes[direction][1][pair] - magnitudes[direction][0][pair]); + float magnitude = magnitudes[direction][0][pair] + + step * (magnitudes[direction][1][pair] - magnitudes[direction][0][pair]); magnitude *= 0.001525879F; return 1.0F - (float) Math.pow(10D, -magnitude / 20F); } @@ -51,24 +56,26 @@ private float normalise(float exponent) { /** * Perform linear interpolation on the phase * - * @param direction The direction, where {@code 0} is feedforward, and {@code 1} is feedback. - * @param pair The pair. - * @param step The step (the interpolation parameter). + * @param direction + * The direction, where {@code 0} is feedforward, and {@code 1} + * is feedback. + * @param pair + * The pair. + * @param step + * The step (the interpolation parameter). * @return The interpolated phase. */ private float interpolatePhase(int direction, int pair, float step) { - float phase = (float) phases[direction][0][pair] + step - * (float) (phases[direction][1][pair] - phases[direction][0][pair]); + float phase = phases[direction][0][pair] + step * (phases[direction][1][pair] - phases[direction][0][pair]); phase *= 0.0001220703F; return normalise(phase); } public int compute(int direction, float step) { if (direction == 0) { - float unity = (float) this.unity[0] + (float) (this.unity[1] - this.unity[0]) * step; + float unity = this.unity[0] + (this.unity[1] - this.unity[0]) * step; unity *= 0.003051758F; - forwardMinimisedCoefficientMultiplier = (float) Math.pow( - 0.10000000000000001D, unity / 20F); + forwardMinimisedCoefficientMultiplier = (float) Math.pow(0.10000000000000001D, unity / 20F); forwardMultiplier = (int) (forwardMinimisedCoefficientMultiplier * 65536F); } if (pairs[direction] == 0) @@ -81,16 +88,14 @@ public int compute(int direction, float step) { float magnitude = interpolateMagnitude(direction, pair, step); float f4 = -2F * magnitude * (float) Math.cos(interpolatePhase(direction, pair, step)); float f5 = magnitude * magnitude; - minimisedCoefficients[direction][pair * 2 + 1] = minimisedCoefficients[direction][pair * 2 - 1] - * f5; - minimisedCoefficients[direction][pair * 2] = minimisedCoefficients[direction][pair * 2 - 1] - * f4 + minimisedCoefficients[direction][pair * 2 - 2] * f5; + minimisedCoefficients[direction][pair * 2 + 1] = minimisedCoefficients[direction][pair * 2 - 1] * f5; + minimisedCoefficients[direction][pair * 2] = minimisedCoefficients[direction][pair * 2 - 1] * f4 + + minimisedCoefficients[direction][pair * 2 - 2] * f5; for (int j1 = pair * 2 - 1; j1 >= 2; j1--) - minimisedCoefficients[direction][j1] += minimisedCoefficients[direction][j1 - 1] - * f4 + minimisedCoefficients[direction][j1 - 2] * f5; + minimisedCoefficients[direction][j1] += minimisedCoefficients[direction][j1 - 1] * f4 + + minimisedCoefficients[direction][j1 - 2] * f5; - minimisedCoefficients[direction][1] += minimisedCoefficients[direction][0] * f4 - + f5; + minimisedCoefficients[direction][1] += minimisedCoefficients[direction][0] * f4 + f5; minimisedCoefficients[direction][0] += f4; } @@ -124,10 +129,8 @@ public void decode(Buffer stream, Envelope soundEnveleope) { for (int direction = 0; direction < 2; direction++) { for (int pair = 0; pair < pairs[direction]; pair++) if ((migration & 1 << direction * 4 << pair) != 0) { - phases[direction][1][pair] = stream - .readUShort(); - magnitudes[direction][1][pair] = stream - .readUShort(); + phases[direction][1][pair] = stream.readUShort(); + magnitudes[direction][1][pair] = stream.readUShort(); } else { phases[direction][1][pair] = phases[direction][0][pair]; magnitudes[direction][1][pair] = magnitudes[direction][0][pair]; diff --git a/Elvarg - Client/src/com/runescape/sound/SoundConstants.java b/Elvarg - Client/src/com/runescape/sound/SoundConstants.java index 237879a..c695f60 100644 --- a/Elvarg - Client/src/com/runescape/sound/SoundConstants.java +++ b/Elvarg - Client/src/com/runescape/sound/SoundConstants.java @@ -1,10 +1,12 @@ package com.runescape.sound; + /** * Class containing sound-related constants. + * * @author 7Winds */ public class SoundConstants { - + /** * Music player */ diff --git a/Elvarg - Client/src/com/runescape/sound/SoundPlayer.java b/Elvarg - Client/src/com/runescape/sound/SoundPlayer.java index 9b4d071..43bf5db 100644 --- a/Elvarg - Client/src/com/runescape/sound/SoundPlayer.java +++ b/Elvarg - Client/src/com/runescape/sound/SoundPlayer.java @@ -1,5 +1,7 @@ package com.runescape.sound; + import java.io.InputStream; + import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; @@ -23,6 +25,7 @@ public class SoundPlayer implements Runnable { /** * Initializes the sound player. + * * @param stream * @param level * @param delay @@ -69,6 +72,7 @@ public void run() { /** * Sets the client's volume level. + * * @param level */ public static void setVolume(int level) { @@ -84,33 +88,34 @@ public static int getVolume() { /** * Returns the decibels for a given volume level. + * * @param level * @return */ public float getDecibels(int level) { switch (level) { - case 1: - return (float) -80.0; - case 2: - return (float) -70.0; - case 3: - return (float) -60.0; - case 4: - return (float) -50.0; - case 5: - return (float) -40.0; - case 6: - return (float) -30.0; - case 7: - return (float) -20.0; - case 8: - return (float) -10.0; - case 9: - return (float) -0.0; - case 10: - return (float) 6.0; - default: - return (float) 0.0; + case 1: + return (float) -80.0; + case 2: + return (float) -70.0; + case 3: + return (float) -60.0; + case 4: + return (float) -50.0; + case 5: + return (float) -40.0; + case 6: + return (float) -30.0; + case 7: + return (float) -20.0; + case 8: + return (float) -10.0; + case 9: + return (float) -0.0; + case 10: + return (float) 6.0; + default: + return (float) 0.0; } } } diff --git a/Elvarg - Client/src/com/runescape/sound/Synthesizer.java b/Elvarg - Client/src/com/runescape/sound/Synthesizer.java index abb537d..bb8ac61 100644 --- a/Elvarg - Client/src/com/runescape/sound/Synthesizer.java +++ b/Elvarg - Client/src/com/runescape/sound/Synthesizer.java @@ -52,7 +52,7 @@ public static void init() { SINE = new int[32768]; for (int j = 0; j < 32768; j++) - SINE[j] = (int) (Math.sin((double) j / 5215.1903000000002D) * 16384D); + SINE[j] = (int) (Math.sin(j / 5215.1903000000002D) * 16384D); samples = new int[0x35d54]; } @@ -63,7 +63,7 @@ public int[] synthesize(int sampleCount, int duration) { if (duration < 10) return samples; - double d = (double) sampleCount / ((double) duration + 0.0D); + double d = sampleCount / (duration + 0.0D); pitch.resetValues(); volume.resetValues(); int pitchMultiplierStep = 0; @@ -72,8 +72,8 @@ public int[] synthesize(int sampleCount, int duration) { if (pitchModifier != null) { pitchModifier.resetValues(); pitchModifierAmplitude.resetValues(); - pitchMultiplierStep = (int) (((double) (pitchModifier.end - pitchModifier.start) * 32.768000000000001D) / d); - pitchModifierBaseStep = (int) (((double) pitchModifier.start * 32.768000000000001D) / d); + pitchMultiplierStep = (int) (((pitchModifier.end - pitchModifier.start) * 32.768000000000001D) / d); + pitchModifierBaseStep = (int) ((pitchModifier.start * 32.768000000000001D) / d); } int volumeMultiplierStep = 0; int volumeMultiplierBaseStep = 0; @@ -81,17 +81,17 @@ public int[] synthesize(int sampleCount, int duration) { if (volumeMultiplier != null) { volumeMultiplier.resetValues(); volumeMultiplierAmplitude.resetValues(); - volumeMultiplierStep = (int) (((double) (volumeMultiplier.end - volumeMultiplier.start) * 32.768000000000001D) / d); - volumeMultiplierBaseStep = (int) (((double) volumeMultiplier.start * 32.768000000000001D) / d); + volumeMultiplierStep = (int) (((volumeMultiplier.end - volumeMultiplier.start) * 32.768000000000001D) / d); + volumeMultiplierBaseStep = (int) ((volumeMultiplier.start * 32.768000000000001D) / d); } for (int index = 0; index < 5; index++) if (oscillatorVolume[index] != 0) { phases[index] = 0; - delays[index] = (int) ((double) anIntArray108[index] * d); + delays[index] = (int) (anIntArray108[index] * d); volumeSteps[index] = (oscillatorVolume[index] << 14) / 100; - pitchSteps[index] = (int) (((double) (pitch.end - pitch.start) * 32.768000000000001D * Math - .pow(1.0057929410678534D, anIntArray107[index])) / d); - pitchBaseSteps[index] = (int) (((double) pitch.start * 32.768000000000001D) / d); + pitchSteps[index] = (int) (((pitch.end - pitch.start) * 32.768000000000001D + * Math.pow(1.0057929410678534D, anIntArray107[index])) / d); + pitchBaseSteps[index] = (int) ((pitch.start * 32.768000000000001D) / d); } for (int sample = 0; sample < sampleCount; sample++) { @@ -100,29 +100,23 @@ public int[] synthesize(int sampleCount, int duration) { if (pitchModifier != null) { int modifier = pitchModifier.step(sampleCount); int ampModifier = pitchModifierAmplitude.step(sampleCount); - pitchChange += evaluateWave(ampModifier, pitchModifierPhase, - pitchModifier.form) >> 1; - pitchModifierPhase += (modifier * pitchMultiplierStep >> 16) - + pitchModifierBaseStep; + pitchChange += evaluateWave(ampModifier, pitchModifierPhase, pitchModifier.form) >> 1; + pitchModifierPhase += (modifier * pitchMultiplierStep >> 16) + pitchModifierBaseStep; } if (volumeMultiplier != null) { int multiplier = volumeMultiplier.step(sampleCount); int ampMultiplier = volumeMultiplierAmplitude.step(sampleCount); volumeChange = volumeChange - * ((evaluateWave(ampMultiplier, volumeMultiplierPhase, - volumeMultiplier.form) >> 1) + 32768) >> 15; - volumeMultiplierPhase += (multiplier * volumeMultiplierStep >> 16) - + volumeMultiplierBaseStep; + * ((evaluateWave(ampMultiplier, volumeMultiplierPhase, volumeMultiplier.form) >> 1) + + 32768) >> 15; + volumeMultiplierPhase += (multiplier * volumeMultiplierStep >> 16) + volumeMultiplierBaseStep; } for (int delay = 0; delay < 5; delay++) if (oscillatorVolume[delay] != 0) { int id = sample + delays[delay]; if (id < sampleCount) { - samples[id] += evaluateWave(volumeChange - * volumeSteps[delay] >> 15, phases[delay], - pitch.form); - phases[delay] += (pitchChange * pitchSteps[delay] >> 16) - + pitchBaseSteps[delay]; + samples[id] += evaluateWave(volumeChange * volumeSteps[delay] >> 15, phases[delay], pitch.form); + phases[delay] += (pitchChange * pitchSteps[delay] >> 16) + pitchBaseSteps[delay]; } } @@ -138,11 +132,9 @@ public int[] synthesize(int sampleCount, int duration) { int off = attack.step(sampleCount); int threshold; if (muted) - threshold = release.start - + ((release.end - release.start) * on >> 8); + threshold = release.start + ((release.end - release.start) * on >> 8); else - threshold = release.start - + ((release.end - release.start) * off >> 8); + threshold = release.start + ((release.end - release.start) * off >> 8); if ((counter += 256) >= threshold) { counter = 0; muted = !muted; @@ -153,7 +145,7 @@ public int[] synthesize(int sampleCount, int duration) { } if (delayTime > 0 && delayDecay > 0) { - int delay = (int) ((double) delayTime * d); + int delay = (int) (delayTime * d); for (int index = delay; index < sampleCount; index++) samples[index] += (samples[index - delay] * delayDecay) / 100; @@ -161,24 +153,21 @@ public int[] synthesize(int sampleCount, int duration) { if (filter.pairs[0] > 0 || filter.pairs[1] > 0) { filterEnvelope.resetValues(); int change = filterEnvelope.step(sampleCount + 1); - int forwardOrder = filter.compute(0, (float) change / 65536F); - int backOrder = filter.compute(1, (float) change / 65536F); + int forwardOrder = filter.compute(0, change / 65536F); + int backOrder = filter.compute(1, change / 65536F); if (sampleCount >= forwardOrder + backOrder) { int index = 0; int delay = backOrder; if (delay > sampleCount - forwardOrder) delay = sampleCount - forwardOrder; for (; index < delay; index++) { - int sample = (int) ((long) samples[index + forwardOrder] - * (long) Filter.forwardMultiplier >> 16); + int sample = (int) ((long) samples[index + forwardOrder] * (long) Filter.forwardMultiplier >> 16); for (int j8 = 0; j8 < forwardOrder; j8++) - sample += (int) ((long) samples[(index + forwardOrder) - - 1 - j8] + sample += (int) ((long) samples[(index + forwardOrder) - 1 - j8] * (long) Filter.coefficients[0][j8] >> 16); for (int j9 = 0; j9 < index; j9++) - sample -= (int) ((long) samples[index - 1 - j9] - * (long) Filter.coefficients[1][j9] >> 16); + sample -= (int) ((long) samples[index - 1 - j9] * (long) Filter.coefficients[1][j9] >> 16); samples[index] = sample; change = filterEnvelope.step(sampleCount + 1); @@ -190,16 +179,13 @@ public int[] synthesize(int sampleCount, int duration) { if (delay > sampleCount - forwardOrder) delay = sampleCount - forwardOrder; for (; index < delay; index++) { - int l8 = (int) ((long) samples[index + forwardOrder] - * (long) Filter.forwardMultiplier >> 16); + int l8 = (int) ((long) samples[index + forwardOrder] * (long) Filter.forwardMultiplier >> 16); for (int k9 = 0; k9 < forwardOrder; k9++) - l8 += (int) ((long) samples[(index + forwardOrder) - - 1 - k9] + l8 += (int) ((long) samples[(index + forwardOrder) - 1 - k9] * (long) Filter.coefficients[0][k9] >> 16); for (int i10 = 0; i10 < backOrder; i10++) - l8 -= (int) ((long) samples[index - 1 - i10] - * (long) Filter.coefficients[1][i10] >> 16); + l8 -= (int) ((long) samples[index - 1 - i10] * (long) Filter.coefficients[1][i10] >> 16); samples[index] = l8; change = filterEnvelope.step(sampleCount + 1); @@ -207,20 +193,18 @@ public int[] synthesize(int sampleCount, int duration) { if (index >= sampleCount - forwardOrder) break; - forwardOrder = filter.compute(0, (float) change / 65536F); - backOrder = filter.compute(1, (float) change / 65536F); + forwardOrder = filter.compute(0, change / 65536F); + backOrder = filter.compute(1, change / 65536F); delay += c; } while (true); for (; index < sampleCount; index++) { int sample = 0; for (int l9 = (index + forwardOrder) - sampleCount; l9 < forwardOrder; l9++) - sample += (int) ((long) samples[(index + forwardOrder) - - 1 - l9] + sample += (int) ((long) samples[(index + forwardOrder) - 1 - l9] * (long) Filter.coefficients[0][l9] >> 16); for (int j10 = 0; j10 < backOrder; j10++) - sample -= (int) ((long) samples[index - 1 - j10] - * (long) Filter.coefficients[1][j10] >> 16); + sample -= (int) ((long) samples[index - 1 - j10] * (long) Filter.coefficients[1][j10] >> 16); samples[index] = sample; } diff --git a/Elvarg - Client/src/com/runescape/sound/Track.java b/Elvarg - Client/src/com/runescape/sound/Track.java index c06d412..60c78a0 100644 --- a/Elvarg - Client/src/com/runescape/sound/Track.java +++ b/Elvarg - Client/src/com/runescape/sound/Track.java @@ -11,7 +11,7 @@ public final class Track { private Track() { synthesizers = new Synthesizer[10]; } - + public static void unpack(Buffer stream) { output = new byte[0x6baa8]; riff = new Buffer(output); @@ -22,7 +22,7 @@ public static void unpack(Buffer stream) { return; tracks[id] = new Track(); tracks[id].decode(stream); - delays[id] = tracks[id].calculateDelay(); + delays[id] = tracks[id].calculateDelay(); } while (true); } @@ -51,8 +51,7 @@ private void decode(Buffer stream) { private int calculateDelay() { int offset = 0x98967f; for (int syntheziser = 0; syntheziser < 10; syntheziser++) - if (synthesizers[syntheziser] != null - && synthesizers[syntheziser].offset / 20 < offset) + if (synthesizers[syntheziser] != null && synthesizers[syntheziser].offset / 20 < offset) offset = synthesizers[syntheziser].offset / 20; if (loopStart < loopEnd && loopStart / 20 < offset) @@ -112,8 +111,7 @@ private int mix(int loops) { if (synthesizers[synthesizer] != null) { int synthDuration = (synthesizers[synthesizer].duration * 22050) / 1000; int synthOffset = (synthesizers[synthesizer].offset * 22050) / 1000; - int samples[] = synthesizers[synthesizer].synthesize(synthDuration, - synthesizers[synthesizer].duration); + int samples[] = synthesizers[synthesizer].synthesize(synthDuration, synthesizers[synthesizer].duration); for (int sample = 0; sample < synthDuration; sample++) output[sample + synthOffset + 44] += (byte) (samples[sample] >> 8); diff --git a/Elvarg - Client/src/com/runescape/util/ChatMessageCodec.java b/Elvarg - Client/src/com/runescape/util/ChatMessageCodec.java index 1c887a4..1d5e4bc 100644 --- a/Elvarg - Client/src/com/runescape/util/ChatMessageCodec.java +++ b/Elvarg - Client/src/com/runescape/util/ChatMessageCodec.java @@ -6,12 +6,10 @@ public final class ChatMessageCodec { private static char[] message = new char[100]; private static Buffer stream = new Buffer(new byte[100]); - private static final char[] VALID_CHARACTERS = { ' ', 'e', 't', 'a', 'o', 'i', - 'h', 'n', 's', 'r', 'd', 'l', 'u', 'm', 'w', 'c', 'y', 'f', 'g', - 'p', 'b', 'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2', '3', '4', - '5', '6', '7', '8', '9', ' ', '!', '?', '.', ',', ':', ';', '(', - ')', '-', '&', '*', '\\', '\'', '@', '#', '+', '=', '\243', '$', - '%', '"', '[', ']' }; + private static final char[] VALID_CHARACTERS = { ' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd', 'l', 'u', + 'm', 'w', 'c', 'y', 'f', 'g', 'p', 'b', 'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2', '3', '4', '5', '6', + '7', '8', '9', ' ', '!', '?', '.', ',', ':', ';', '(', ')', '-', '&', '*', '\\', '\'', '@', '#', '+', '=', + '\243', '$', '%', '"', '[', ']' }; public static String decode(int length, Buffer buffer) { int index = 0; @@ -67,7 +65,7 @@ public static void encode(String string, Buffer buffer) { charIndex = count; break; } - + if (charIndex > 12) { charIndex += 195; } @@ -94,7 +92,7 @@ public static String processText(String string) { encode(string, stream); int length = stream.currentPosition; stream.currentPosition = 0; - + return decode(length, stream); } } diff --git a/Elvarg - Client/src/com/runescape/util/LoggerUtils.java b/Elvarg - Client/src/com/runescape/util/LoggerUtils.java index 15145bb..60f774b 100644 --- a/Elvarg - Client/src/com/runescape/util/LoggerUtils.java +++ b/Elvarg - Client/src/com/runescape/util/LoggerUtils.java @@ -3,9 +3,9 @@ import java.util.logging.Logger; public final class LoggerUtils { - - public static Logger getLogger(Class clazz) { - return Logger.getLogger(clazz.getName()); - } + + public static Logger getLogger(Class clazz) { + return Logger.getLogger(clazz.getName()); + } } diff --git a/Elvarg - Client/src/com/runescape/util/MessageCensor.java b/Elvarg - Client/src/com/runescape/util/MessageCensor.java index e336a49..a53d5f6 100644 --- a/Elvarg - Client/src/com/runescape/util/MessageCensor.java +++ b/Elvarg - Client/src/com/runescape/util/MessageCensor.java @@ -11,24 +11,22 @@ public final class MessageCensor { private static char[][] domains; private static char[][] tldList; private static int[] tlds; - private static final String[] exceptions = { "cook", "cook's", "cooks", - "seeks", "sheet", "woop", "woops", "faq", "noob", "noobs" }; + private static final String[] exceptions = { "cook", "cook's", "cooks", "seeks", "sheet", "woop", "woops", "faq", + "noob", "noobs" }; public static void load(FileArchive archive) { - Buffer fragments = new Buffer( - archive.readFile("fragmentsenc.txt")); + Buffer fragments = new Buffer(archive.readFile("fragmentsenc.txt")); Buffer bad = new Buffer(archive.readFile("badenc.txt")); Buffer domain = new Buffer(archive.readFile("domainenc.txt")); Buffer tldlist = new Buffer(archive.readFile("tldlist.txt")); - decode(fragments, bad, domain, tldlist); + decode(fragments, bad, domain, tldlist); } - private static void decode(Buffer fragments, Buffer badenc, - Buffer domainenc, Buffer tldlist) { - decodeBadEnc(badenc); + private static void decode(Buffer fragments, Buffer badenc, Buffer domainenc, Buffer tldlist) { + decodeBadEnc(badenc); decodeDomainEnc(domainenc); - decodeFragmentsEnc(fragments); - decodeTldList(tldlist); + decodeFragmentsEnc(fragments); + decodeTldList(tldlist); } private static void decodeTldList(Buffer stream) { @@ -53,7 +51,7 @@ private static void decodeBadEnc(Buffer stream) { initBad(stream, badWords, badEncoding); } - private static void decodeDomainEnc(Buffer stream) { + private static void decodeDomainEnc(Buffer stream) { int i = stream.readInt(); domains = new char[i][]; initDomains(domains, stream); @@ -65,8 +63,7 @@ private static void decodeFragmentsEnc(Buffer stream) { fragments[i] = stream.readUShort(); } - private static void initBad(Buffer stream, char[][] words, - byte[][][] complexBadEnc) { + private static void initBad(Buffer stream, char[][] words, byte[][][] complexBadEnc) { for (int index = 0; index < words.length; index++) { char[] word = new char[stream.readUnsignedByte()]; for (int character = 0; character < word.length; character++) @@ -112,8 +109,7 @@ private static void stripIllegalCharacters(char ac[]) { } private static boolean legalCharacter(char c) { - return c >= ' ' && c <= '\177' || c == ' ' || c == '\n' || c == '\t' - || c == '\243' || c == '\u20AC'; + return c >= ' ' && c <= '\177' || c == ' ' || c == '\n' || c == '\t' || c == '\243' || c == '\u20AC'; } public static String apply(String message) { @@ -128,8 +124,7 @@ public static String apply(String message) { censorDomains(chars); method514(chars); for (int index = 0; index < exceptions.length; index++) { - for (int k = -1; (k = trimmedLowerCase.indexOf(exceptions[index], - k + 1)) != -1;) { + for (int k = -1; (k = trimmedLowerCase.indexOf(exceptions[index], k + 1)) != -1;) { char ac1[] = exceptions[index].toCharArray(); System.arraycopy(ac1, 0, chars, k, ac1.length); @@ -282,12 +277,10 @@ private static void censorTlds(char[] chars) { char[] slash = { 's', 'l', 'a', 's', 'h' }; method509(null, clone2, slash); for (int index = 0; index < tldList.length; index++) - method506(clone2, tldList[index], tlds[index], clone, - chars); + method506(clone2, tldList[index], tlds[index], clone, chars); } - private static void method506(char ac[], char ac1[], int i, char ac2[], - char ac3[]) { + private static void method506(char ac[], char ac1[], int i, char ac2[], char ac3[]) { if (ac1.length > ac3.length) return; int j; @@ -497,11 +490,9 @@ private static void method509(byte abyte0[][], char ac[], char ac1[]) { } else { boolean flag5 = false; boolean flag6 = false; - if (k - 1 < 0 || isNotAlphanumeric(ac[k - 1]) - && ac[k - 1] != '\'') + if (k - 1 < 0 || isNotAlphanumeric(ac[k - 1]) && ac[k - 1] != '\'') flag5 = true; - if (l >= ac.length || isNotAlphanumeric(ac[l]) - && ac[l] != '\'') + if (l >= ac.length || isNotAlphanumeric(ac[l]) && ac[l] != '\'') flag6 = true; if (!flag5 || !flag6) { boolean flag7 = false; @@ -509,14 +500,11 @@ private static void method509(byte abyte0[][], char ac[], char ac1[]) { if (flag5) k2 = k; for (; !flag7 && k2 < l; k2++) - if (k2 >= 0 - && (!isNotAlphanumeric(ac[k2]) || ac[k2] == '\'')) { + if (k2 >= 0 && (!isNotAlphanumeric(ac[k2]) || ac[k2] == '\'')) { char ac2[] = new char[3]; int j3; for (j3 = 0; j3 < 3; j3++) { - if (k2 + j3 >= ac.length - || isNotAlphanumeric(ac[k2 + j3]) - && ac[k2 + j3] != '\'') + if (k2 + j3 >= ac.length || isNotAlphanumeric(ac[k2 + j3]) && ac[k2 + j3] != '\'') break; ac2[j3] = ac[k2 + j3]; } @@ -524,9 +512,7 @@ private static void method509(byte abyte0[][], char ac[], char ac1[]) { boolean flag8 = true; if (j3 == 0) flag8 = false; - if (j3 < 3 - && k2 - 1 >= 0 - && (!isNotAlphanumeric(ac[k2 - 1]) || ac[k2 - 1] == '\'')) + if (j3 < 3 && k2 - 1 >= 0 && (!isNotAlphanumeric(ac[k2 - 1]) || ac[k2 - 1] == '\'')) flag8 = false; if (flag8 && !containsFragment(ac2)) flag7 = true; @@ -574,8 +560,7 @@ private static boolean method510(byte byte0, byte abyte0[][], byte byte2) { int k = (i + j) / 2; if (abyte0[k][0] == byte0 && abyte0[k][1] == byte2) return true; - if (byte0 < abyte0[k][0] || byte0 == abyte0[k][0] - && byte2 < abyte0[k][1]) + if (byte0 < abyte0[k][0] || byte0 == abyte0[k][0] && byte2 < abyte0[k][1]) j = k; else i = k; @@ -611,14 +596,12 @@ private static int method512(char c, char c1, char c2) { if (c2 == 'b') { if (c1 == '6' || c1 == '8') return 1; - return (c1 != '1' || c != '3') && (c1 != 'i' || c != '3') ? 0 - : 2; + return (c1 != '1' || c != '3') && (c1 != 'i' || c != '3') ? 0 : 2; } if (c2 == 'c') return c1 != '(' && c1 != '<' && c1 != '{' && c1 != '[' ? 0 : 1; if (c2 == 'd') - return (c1 != '[' || c != ')') && (c1 != 'i' || c != ')') ? 0 - : 2; + return (c1 != '[' || c != ')') && (c1 != 'i' || c != ')') ? 0 : 2; if (c2 == 'e') return c1 != '3' && c1 != '\u20AC' ? 0 : 1; if (c2 == 'f') { @@ -631,9 +614,8 @@ private static int method512(char c, char c1, char c2) { if (c2 == 'h') return c1 != '#' ? 0 : 1; if (c2 == 'i') - return c1 != 'y' && c1 != 'l' && c1 != 'j' && c1 != '1' - && c1 != '!' && c1 != ':' && c1 != ';' && c1 != '|' ? 0 - : 1; + return c1 != 'y' && c1 != 'l' && c1 != 'j' && c1 != '1' && c1 != '!' && c1 != ':' && c1 != ';' + && c1 != '|' ? 0 : 1; if (c2 == 'j') return 0; if (c2 == 'k') @@ -649,9 +631,8 @@ private static int method512(char c, char c1, char c2) { if (c2 == 'o') { if (c1 == '0' || c1 == '*') return 1; - return (c1 != '(' || c != ')') && (c1 != '[' || c != ']') - && (c1 != '{' || c != '}') && (c1 != '<' || c != '>') ? 0 - : 2; + return (c1 != '(' || c != ')') && (c1 != '[' || c != ']') && (c1 != '{' || c != '}') + && (c1 != '<' || c != '>') ? 0 : 2; } if (c2 == 'p') return 0; @@ -666,18 +647,15 @@ private static int method512(char c, char c1, char c2) { if (c2 == 'u') { if (c1 == 'v') return 1; - return (c1 != '\\' || c != '/') && (c1 != '\\' || c != '|') - && (c1 != '|' || c != '/') ? 0 : 2; + return (c1 != '\\' || c != '/') && (c1 != '\\' || c != '|') && (c1 != '|' || c != '/') ? 0 : 2; } if (c2 == 'v') - return (c1 != '\\' || c != '/') && (c1 != '\\' || c != '|') - && (c1 != '|' || c != '/') ? 0 : 2; + return (c1 != '\\' || c != '/') && (c1 != '\\' || c != '|') && (c1 != '|' || c != '/') ? 0 : 2; if (c2 == 'w') return c1 != 'v' || c != 'v' ? 0 : 2; if (c2 == 'x') - return (c1 != ')' || c != '(') && (c1 != '}' || c != '{') - && (c1 != ']' || c != '[') && (c1 != '>' || c != '<') ? 0 - : 2; + return (c1 != ')' || c != '(') && (c1 != '}' || c != '{') && (c1 != ']' || c != '[') + && (c1 != '>' || c != '<') ? 0 : 2; if (c2 == 'y') return 0; if (c2 == 'z') @@ -687,8 +665,7 @@ private static int method512(char c, char c1, char c2) { if (c2 == '0') { if (c1 == 'o' || c1 == 'O') return 1; - return (c1 != '(' || c != ')') && (c1 != '{' || c != '}') - && (c1 != '[' || c != ']') ? 0 : 2; + return (c1 != '(' || c != ')') && (c1 != '{' || c != '}') && (c1 != '[' || c != ']') ? 0 : 2; } if (c2 == '1') return c1 != 'l' ? 0 : 1; @@ -813,8 +790,7 @@ private static boolean isNotAlphanumeric(char c) { } private static boolean method518(char c) { - return c < 'a' || c > 'z' || c == 'v' || c == 'x' || c == 'j' - || c == 'q' || c == 'z'; + return c < 'a' || c > 'z' || c == 'v' || c == 'x' || c == 'j' || c == 'q' || c == 'z'; } private static boolean isLetter(char c) { diff --git a/Elvarg - Client/src/com/runescape/util/MiscUtils.java b/Elvarg - Client/src/com/runescape/util/MiscUtils.java index e647cba..9920173 100644 --- a/Elvarg - Client/src/com/runescape/util/MiscUtils.java +++ b/Elvarg - Client/src/com/runescape/util/MiscUtils.java @@ -4,32 +4,29 @@ public final class MiscUtils { - public static void launchURL(String url) { - String osName = System.getProperty("os.name"); - try { - if (osName.startsWith("Mac OS")) { - Class fileMgr = Class.forName("com.apple.eio.FileManager"); - Method openURL = fileMgr.getDeclaredMethod("openURL", - new Class[] {String.class}); - openURL.invoke(null, new Object[] {url}); - } else if (osName.startsWith("Windows")) - Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); - else { - String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", - "netscape", "safari"}; - String browser = null; - for (int count = 0; count < browsers.length && browser == null; count++) - if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}) - .waitFor() == 0) - browser = browsers[count]; - if (browser == null) { - throw new Exception("Could not find web browser"); - } else - Runtime.getRuntime().exec(new String[] {browser, url}); - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } + public static void launchURL(String url) { + String osName = System.getProperty("os.name"); + try { + if (osName.startsWith("Mac OS")) { + Class fileMgr = Class.forName("com.apple.eio.FileManager"); + Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class }); + openURL.invoke(null, new Object[] { url }); + } else if (osName.startsWith("Windows")) + Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); + else { + String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape", "safari" }; + String browser = null; + for (int count = 0; count < browsers.length && browser == null; count++) + if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0) + browser = browsers[count]; + if (browser == null) { + throw new Exception("Could not find web browser"); + } else + Runtime.getRuntime().exec(new String[] { browser, url }); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } } diff --git a/Elvarg - Client/src/com/runescape/util/MouseDetection.java b/Elvarg - Client/src/com/runescape/util/MouseDetection.java index 5c158ec..b99435e 100644 --- a/Elvarg - Client/src/com/runescape/util/MouseDetection.java +++ b/Elvarg - Client/src/com/runescape/util/MouseDetection.java @@ -4,6 +4,7 @@ public final class MouseDetection implements Runnable { + @Override public void run() { while (running) { synchronized (syncObject) { diff --git a/Elvarg - Client/src/com/runescape/util/PacketConstants.java b/Elvarg - Client/src/com/runescape/util/PacketConstants.java index 443f4da..83301fb 100644 --- a/Elvarg - Client/src/com/runescape/util/PacketConstants.java +++ b/Elvarg - Client/src/com/runescape/util/PacketConstants.java @@ -1,4 +1,5 @@ package com.runescape.util; + /** * The class that contains packet-related constants. * @@ -6,25 +7,25 @@ * @author TheChosenOne */ public final class PacketConstants { - + private PacketConstants() { - + } - + public static final int FOCUS_CHANGE = 3; - + public static final int FLAG_ACCOUNT = 45; - + public static final int REPORT_PLAYER = 218; - + public static final int IDLE = 0; - + public static final int INTERFACE_SCROLL_RESET = 9; - + public static final int CAMERA_MOVEMENT = 86; - + public static final int ENTER_REGION = 210; - + public static final int UPDATE_PLAYER_RIGHTS = 127; public static final int PLAYER_UPDATING = 81; @@ -38,7 +39,7 @@ private PacketConstants() { public static final int TRANSFORM_PLAYER_TO_OBJECT = 147; public static final int SEND_REMOVE_OBJECT = 101; - + public static final int DESIGN_SCREEN = 101; public static final int SEND_PROJECTILE = 117; @@ -52,11 +53,11 @@ private PacketConstants() { public static final int SEND_GFX = 4; public static final int OPEN_WELCOME_SCREEN = 176; - + public static final int SHOW_CLANCHAT_OPTIONS = 115; public static final int SHOW_PLAYER_HEAD_ON_INTERFACE = 185; - + public static final int BUTTON_CLICK = 185; public static final int CLAN_CHAT = 217; // 317 did not have this @@ -64,7 +65,7 @@ private PacketConstants() { public static final int RESET_CAMERA = 107; public static final int CLEAN_ITEMS_OF_INTERFACE = 72; - + public static final int MOVE_ITEM = 214; public static final int SPIN_CAMERA = 166; @@ -76,126 +77,125 @@ private PacketConstants() { public static final int PLAY_SONG = 74; public static final int NEXT_OR_PREVIOUS_SONG = 121; - + public static final int LOADED_REGION = 121; public static final int LOGOUT = 109; public static final int MOVE_COMPONENT = 70; - public static final int SEND_WALKABLE_INTERFACE = 208; + public static final int SEND_WALKABLE_INTERFACE = 208; - public static final int SEND_MINIMAP_STATE = 99; + public static final int SEND_MINIMAP_STATE = 99; - public static final int SHOW_NPC_HEAD_ON_INTERFACE = 75; + public static final int SHOW_NPC_HEAD_ON_INTERFACE = 75; - public static final int SEND_MULTIPLE_MAP_PACKETS = 60; + public static final int SEND_MULTIPLE_MAP_PACKETS = 60; - public static final int SEND_EARTHQUAKE = 35; + public static final int SEND_EARTHQUAKE = 35; - public static final int SEND_PLAYER_OPTION = 104; + public static final int SEND_PLAYER_OPTION = 104; - public static final int CLEAR_MINIMAP_FLAG = 78; - - public static final int SET_AUTOCAST_ID = 38; + public static final int CLEAR_MINIMAP_FLAG = 78; - public static final int SEND_CLAN_CHAT_MESSAGE = 252; - - public static final int SEND_MESSAGE = 253; + public static final int SET_AUTOCAST_ID = 38; - public static final int STOP_ALL_ANIMATIONS = 1; + public static final int SEND_CLAN_CHAT_MESSAGE = 252; - public static final int ADD_FRIEND = 50; + public static final int SEND_MESSAGE = 253; - public static final int REMOVE_FRIEND = 51; - - public static final int ADD_IGNORE = 214; - - public static final int REMOVE_IGNORE = 215; - - public static final int SEND_RUN_ENERGY = 110; + public static final int STOP_ALL_ANIMATIONS = 1; - public static final int SEND_TOGGLE_RUN = 113; - - public static final int SEND_HINT_ICON = 254; + public static final int ADD_FRIEND = 50; - public static final int SEND_DUO_INTERFACE = 248; + public static final int REMOVE_FRIEND = 51; - public static final int SEND_RECEIVED_PRIVATE_MESSAGE = 196; + public static final int ADD_IGNORE = 214; - public static final int SEND_REGION = 85; + public static final int REMOVE_IGNORE = 215; - public static final int SEND_ITEM_TO_INTERFACE = 246; + public static final int SEND_RUN_ENERGY = 110; - public static final int SHOW_HIDE_INTERFACE_CONTAINER = 171; + public static final int SEND_TOGGLE_RUN = 113; - public static final int SEND_SOLO_NON_WALKABLE_SIDEBAR_INTERFACE = 142; + public static final int SEND_HINT_ICON = 254; - public static final int SET_INTERFACE_TEXT = 126; - - public static final int SEND_CONSOLE_COMMAND = 123; + public static final int SEND_DUO_INTERFACE = 248; - public static final int UPDATE_CHAT_MODES = 206; + public static final int SEND_RECEIVED_PRIVATE_MESSAGE = 196; - public static final int SEND_PLAYER_WEIGHT = 240; + public static final int SEND_REGION = 85; - public static final int SEND_MODEL_TO_INTERFACE = 8; + public static final int SEND_ITEM_TO_INTERFACE = 246; - public static final int SEND_CHANGE_INTERFACE_COLOUR = 122; + public static final int SHOW_HIDE_INTERFACE_CONTAINER = 171; - public static final int SEND_UPDATE_ITEMS = 53; - - public static final int SEND_EFFECT_TIMER = 54; - - public static final int SEND_CURRENT_BANK_TAB = 55; - - public static final int SET_MODEL_INTERFACE_ZOOM = 230; + public static final int SEND_SOLO_NON_WALKABLE_SIDEBAR_INTERFACE = 142; - public static final int SET_FRIENDSERVER_STATUS = 221; + public static final int SET_INTERFACE_TEXT = 126; - public static final int MOVE_CAMERA = 177; + public static final int SEND_CONSOLE_COMMAND = 123; - public static final int SEND_INITIALIZE_PACKET = 249; + public static final int UPDATE_CHAT_MODES = 206; - public static final int NPC_UPDATING = 65; + public static final int SEND_PLAYER_WEIGHT = 240; - public static final int SEND_ENTER_AMOUNT = 27; + public static final int SEND_MODEL_TO_INTERFACE = 8; - public static final int SEND_ENTER_NAME = 187; + public static final int SEND_CHANGE_INTERFACE_COLOUR = 122; - public static final int SEND_NON_WALKABLE_INTERFACE = 97; + public static final int SEND_UPDATE_ITEMS = 53; - public static final int SEND_WALKABLE_CHATBOX_INTERFACE = 218; + public static final int SEND_EFFECT_TIMER = 54; - public static final int SEND_CONFIG_INT = 87; + public static final int SEND_CURRENT_BANK_TAB = 55; - public static final int SEND_CONFIG_BYTE = 36; + public static final int SET_MODEL_INTERFACE_ZOOM = 230; - public static final int SEND_MULTICOMBAT_ICON = 61; + public static final int SET_FRIENDSERVER_STATUS = 221; - public static final int SEND_ANIMATE_INTERFACE = 200; + public static final int MOVE_CAMERA = 177; - public static final int CLOSE_INTERFACE = 219; + public static final int SEND_INITIALIZE_PACKET = 249; - public static final int UPDATE_SPECIFIC_ITEM = 34; + public static final int NPC_UPDATING = 65; - public static final int SWITCH_TAB = 106; + public static final int SEND_ENTER_AMOUNT = 27; - public static final int SEND_NONWALKABLE_CHATBOX_INTERFACE = 164; + public static final int SEND_ENTER_NAME = 187; + + public static final int SEND_NON_WALKABLE_INTERFACE = 97; + + public static final int SEND_WALKABLE_CHATBOX_INTERFACE = 218; + + public static final int SEND_CONFIG_INT = 87; + + public static final int SEND_CONFIG_BYTE = 36; + + public static final int SEND_MULTICOMBAT_ICON = 61; + + public static final int SEND_ANIMATE_INTERFACE = 200; + + public static final int CLOSE_INTERFACE = 219; + + public static final int UPDATE_SPECIFIC_ITEM = 34; + + public static final int SWITCH_TAB = 106; + + public static final int SEND_NONWALKABLE_CHATBOX_INTERFACE = 164; public static final int SEND_MAP_REGION = 73; public static final int SEND_REGION_MAP_REGION = 241; - + public static final int MOUSE_CLICK = 241; - + public static final int SYSTEM_UPDATE = 114; - + public static final int PLAY_SOUND_EFFECT = 174; - + public static final int IDLE_LOGOUT = 202; - + public static final int ITEM_ON_NPC = 57; - - + } diff --git a/Elvarg - Client/src/com/runescape/util/SkillConstants.java b/Elvarg - Client/src/com/runescape/util/SkillConstants.java index acba0fd..6ea8c3c 100644 --- a/Elvarg - Client/src/com/runescape/util/SkillConstants.java +++ b/Elvarg - Client/src/com/runescape/util/SkillConstants.java @@ -3,15 +3,13 @@ public final class SkillConstants { public static final int SKILL_COUNT = 23; - - public static final String[] SKILL_NAMES = { "Attack", "Constitution", - "Mining", "Strength", "Agility", "Smithing", "Defence", "Herblore", - "Fishing", "Range", "Thieving", "Cooking", "Prayer", "Crafting", - "Firemaking", "Magic", "Fletching", "Woodcutting", "Runecrafting", - "Slayer", "Farming", "Construction", "-unused", "-unused" }; - - public static final boolean[] ENABLED_SKILLS = { true, true, true, true, - true, true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, false, false, false }; + + public static final String[] SKILL_NAMES = { "Attack", "Constitution", "Mining", "Strength", "Agility", "Smithing", + "Defence", "Herblore", "Fishing", "Range", "Thieving", "Cooking", "Prayer", "Crafting", "Firemaking", + "Magic", "Fletching", "Woodcutting", "Runecrafting", "Slayer", "Farming", "Construction", "-unused", + "-unused" }; + + public static final boolean[] ENABLED_SKILLS = { true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, false, false, false }; } diff --git a/Elvarg - Client/src/com/runescape/util/Stopwatch.java b/Elvarg - Client/src/com/runescape/util/Stopwatch.java index 83c6cf2..eae27a1 100644 --- a/Elvarg - Client/src/com/runescape/util/Stopwatch.java +++ b/Elvarg - Client/src/com/runescape/util/Stopwatch.java @@ -26,11 +26,11 @@ public long elapsed() { public boolean elapsed(long time) { return elapsed() >= time; } - + public long getTime() { return time; } - + public Stopwatch() { time = 0; } diff --git a/Elvarg - Client/src/com/runescape/util/StringUtils.java b/Elvarg - Client/src/com/runescape/util/StringUtils.java index 868a72c..02e3f5b 100644 --- a/Elvarg - Client/src/com/runescape/util/StringUtils.java +++ b/Elvarg - Client/src/com/runescape/util/StringUtils.java @@ -1,9 +1,12 @@ package com.runescape.util; + import com.runescape.sign.SignLink; public final class StringUtils { - private static final char[] BASE_37_CHARACTERS = { '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; + private static final char[] BASE_37_CHARACTERS = { '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', + '7', '8', '9' }; public static long encodeBase37(String string) { long encoded = 0L; @@ -47,7 +50,7 @@ public static long hashSpriteName(String name) { name = name.toUpperCase(); long hash = 0L; for (int index = 0; index < name.length(); index++) { - hash = (hash * 61L + (long) name.charAt(index)) - 32L; + hash = (hash * 61L + name.charAt(index)) - 32L; hash = hash + (hash >> 56) & 0xffffffffffffffL; } return hash; diff --git a/Elvarg - Client/src/org/seven/cache/graphics/RSFont.java b/Elvarg - Client/src/org/seven/cache/graphics/RSFont.java index 93450d1..5ee7f22 100644 --- a/Elvarg - Client/src/org/seven/cache/graphics/RSFont.java +++ b/Elvarg - Client/src/org/seven/cache/graphics/RSFont.java @@ -1,150 +1,150 @@ package org.seven.cache.graphics; + import java.awt.Color; import com.runescape.cache.FileArchive; -import com.runescape.cache.graphics.GameFont; import com.runescape.cache.graphics.Sprite; import com.runescape.draw.Rasterizer2D; import com.runescape.io.Buffer; public class RSFont extends Rasterizer2D { - public int baseCharacterHeight = 0; - public int anInt4142; - public int anInt4144; - public int[] characterDrawYOffsets; - public int[] characterHeights; - public int[] characterDrawXOffsets; - public int[] characterWidths; - public int[] iconWidths; - public byte[] aByteArray4151; - public byte[][] fontPixels; - public int[] characterScreenWidths; - public static Sprite[] chatImages; - public static Sprite[] clanImages; - public static String aRSString_4135; - public static String startTransparency; - public static String startDefaultShadow; - public static String endShadow = "/shad"; - public static String endEffect; - public static String aRSString_4143; - public static String endStrikethrough = "/str"; - public static String aRSString_4147; - public static String startColor; - public static String lineBreak; - public static String startStrikethrough; - public static String endColor; - public static String startImage; - public static String startClanImage; - public static String endUnderline; - public static String defaultStrikethrough; - public static String startShadow; - public static String startEffect; - public static String aRSString_4162; - public static String aRSString_4163; - public static String endTransparency; - public static String aRSString_4165; - public static String startUnderline; - public static String startDefaultUnderline; - public static String aRSString_4169; - public static String[] splitTextStrings; - public static int defaultColor; - public static int textShadowColor; - public static int strikethroughColor; - public static int defaultTransparency; - public static int anInt4175; - public static int underlineColor; - public static int defaultShadow; - public static int anInt4178; - public static int transparency; - public static int textColor; - - public RSFont(boolean TypeFont, String s, FileArchive archive) { - fontPixels = new byte[256][]; - characterWidths = new int[256]; - characterHeights = new int[256]; - characterDrawXOffsets = new int[256]; - characterDrawYOffsets = new int[256]; - characterScreenWidths = new int[256]; - Buffer stream = new Buffer(archive.readFile(s + ".dat")); - Buffer stream_1 = new Buffer(archive.readFile("index.dat")); - stream_1.currentPosition = stream.readUShort() + 4; - int k = stream_1.readUnsignedByte(); - if (k > 0) { - stream_1.currentPosition += 3 * (k - 1); - } - for (int l = 0; l < 256; l++) { - characterDrawXOffsets[l] = stream_1.readUnsignedByte(); - characterDrawYOffsets[l] = stream_1.readUnsignedByte(); - int i1 = characterWidths[l] = stream_1.readUShort(); - int j1 = characterHeights[l] = stream_1.readUShort(); - int k1 = stream_1.readUnsignedByte(); - int l1 = i1 * j1; - fontPixels[l] = new byte[l1]; - if (k1 == 0) { - for (int i2 = 0; i2 < l1; i2++) { - fontPixels[l][i2] = stream.readSignedByte(); - } - - } else if (k1 == 1) { - for (int j2 = 0; j2 < i1; j2++) { - for (int l2 = 0; l2 < j1; l2++) { - fontPixels[l][j2 + l2 * i1] = stream.readSignedByte(); - } - - } - - } - if (j1 > baseCharacterHeight && l < 128) { - baseCharacterHeight = j1; - } - characterDrawXOffsets[l] = 1; - characterScreenWidths[l] = i1 + 2; - int k2 = 0; - for (int i3 = j1 / 7; i3 < j1; i3++) { - k2 += fontPixels[l][i3 * i1]; - } - - if (k2 <= j1 / 7) { - characterScreenWidths[l]--; - characterDrawXOffsets[l] = 0; - } - k2 = 0; - for (int j3 = j1 / 7; j3 < j1; j3++) { - k2 += fontPixels[l][(i1 - 1) + j3 * i1]; - } - - if (k2 <= j1 / 7) { - characterScreenWidths[l]--; - } - } - - if (TypeFont) { - characterScreenWidths[32] = characterScreenWidths[73]; - } else { - characterScreenWidths[32] = characterScreenWidths[105]; - } - } - - public void drawStringMoveY(String string, int drawX, int drawY, int color, - int shadow, int randomMod, int randomMod2) { - if (string != null) { - setColorAndShadow(color, shadow); - double d = 7.0 - (double) randomMod2 / 8.0; - if (d < 0.0) { - d = 0.0; - } - int[] yOffset = new int[string.length()]; - for (int index = 0; index < string.length(); index++) { - yOffset[index] = (int) (Math.sin((double) index / 1.5 + (double) randomMod) * d); - } - drawBaseStringMoveXY(string, drawX - getTextWidth(string) / 2, drawY, null, yOffset); - } - } - - public int getCharacterWidth(int i) { - return characterScreenWidths[i & 0xff]; - } + public int baseCharacterHeight = 0; + public int anInt4142; + public int anInt4144; + public int[] characterDrawYOffsets; + public int[] characterHeights; + public int[] characterDrawXOffsets; + public int[] characterWidths; + public int[] iconWidths; + public byte[] aByteArray4151; + public byte[][] fontPixels; + public int[] characterScreenWidths; + public static Sprite[] chatImages; + public static Sprite[] clanImages; + public static String aRSString_4135; + public static String startTransparency; + public static String startDefaultShadow; + public static String endShadow = "/shad"; + public static String endEffect; + public static String aRSString_4143; + public static String endStrikethrough = "/str"; + public static String aRSString_4147; + public static String startColor; + public static String lineBreak; + public static String startStrikethrough; + public static String endColor; + public static String startImage; + public static String startClanImage; + public static String endUnderline; + public static String defaultStrikethrough; + public static String startShadow; + public static String startEffect; + public static String aRSString_4162; + public static String aRSString_4163; + public static String endTransparency; + public static String aRSString_4165; + public static String startUnderline; + public static String startDefaultUnderline; + public static String aRSString_4169; + public static String[] splitTextStrings; + public static int defaultColor; + public static int textShadowColor; + public static int strikethroughColor; + public static int defaultTransparency; + public static int anInt4175; + public static int underlineColor; + public static int defaultShadow; + public static int anInt4178; + public static int transparency; + public static int textColor; + + public RSFont(boolean TypeFont, String s, FileArchive archive) { + fontPixels = new byte[256][]; + characterWidths = new int[256]; + characterHeights = new int[256]; + characterDrawXOffsets = new int[256]; + characterDrawYOffsets = new int[256]; + characterScreenWidths = new int[256]; + Buffer stream = new Buffer(archive.readFile(s + ".dat")); + Buffer stream_1 = new Buffer(archive.readFile("index.dat")); + stream_1.currentPosition = stream.readUShort() + 4; + int k = stream_1.readUnsignedByte(); + if (k > 0) { + stream_1.currentPosition += 3 * (k - 1); + } + for (int l = 0; l < 256; l++) { + characterDrawXOffsets[l] = stream_1.readUnsignedByte(); + characterDrawYOffsets[l] = stream_1.readUnsignedByte(); + int i1 = characterWidths[l] = stream_1.readUShort(); + int j1 = characterHeights[l] = stream_1.readUShort(); + int k1 = stream_1.readUnsignedByte(); + int l1 = i1 * j1; + fontPixels[l] = new byte[l1]; + if (k1 == 0) { + for (int i2 = 0; i2 < l1; i2++) { + fontPixels[l][i2] = stream.readSignedByte(); + } + + } else if (k1 == 1) { + for (int j2 = 0; j2 < i1; j2++) { + for (int l2 = 0; l2 < j1; l2++) { + fontPixels[l][j2 + l2 * i1] = stream.readSignedByte(); + } + + } + + } + if (j1 > baseCharacterHeight && l < 128) { + baseCharacterHeight = j1; + } + characterDrawXOffsets[l] = 1; + characterScreenWidths[l] = i1 + 2; + int k2 = 0; + for (int i3 = j1 / 7; i3 < j1; i3++) { + k2 += fontPixels[l][i3 * i1]; + } + + if (k2 <= j1 / 7) { + characterScreenWidths[l]--; + characterDrawXOffsets[l] = 0; + } + k2 = 0; + for (int j3 = j1 / 7; j3 < j1; j3++) { + k2 += fontPixels[l][(i1 - 1) + j3 * i1]; + } + + if (k2 <= j1 / 7) { + characterScreenWidths[l]--; + } + } + + if (TypeFont) { + characterScreenWidths[32] = characterScreenWidths[73]; + } else { + characterScreenWidths[32] = characterScreenWidths[105]; + } + } + + public void drawStringMoveY(String string, int drawX, int drawY, int color, int shadow, int randomMod, + int randomMod2) { + if (string != null) { + setColorAndShadow(color, shadow); + double d = 7.0 - randomMod2 / 8.0; + if (d < 0.0) { + d = 0.0; + } + int[] yOffset = new int[string.length()]; + for (int index = 0; index < string.length(); index++) { + yOffset[index] = (int) (Math.sin(index / 1.5 + randomMod) * d); + } + drawBaseStringMoveXY(string, drawX - getTextWidth(string) / 2, drawY, null, yOffset); + } + } + + public int getCharacterWidth(int i) { + return characterScreenWidths[i & 0xff]; + } public void setTrans(int i, int j, int k) { textShadowColor = defaultShadow = i; @@ -153,701 +153,679 @@ public void setTrans(int i, int j, int k) { } public void drawCenteredString(String s, int i, int j) { - if(s != null) - drawBasicString(s, i - getTextWidth(s) / 2, j); + if (s != null) + drawBasicString(s, i - getTextWidth(s) / 2, j); + } + + public void setDefaultTextEffectValues(int color, int shadow, int trans) { + strikethroughColor = -1; + underlineColor = -1; + textShadowColor = defaultShadow = shadow; + textColor = defaultColor = color; + transparency = defaultTransparency = trans; + anInt4178 = 0; + anInt4175 = 0; + } + + public static int method1014(byte[][] is, byte[][] is_27_, int[] is_28_, int[] is_29_, int[] is_30_, int i, + int i_31_) { + int i_32_ = is_28_[i]; + int i_33_ = i_32_ + is_30_[i]; + int i_34_ = is_28_[i_31_]; + int i_35_ = i_34_ + is_30_[i_31_]; + int i_36_ = i_32_; + if (i_34_ > i_32_) { + i_36_ = i_34_; + } + int i_37_ = i_33_; + if (i_35_ < i_33_) { + i_37_ = i_35_; + } + int i_38_ = is_29_[i]; + if (is_29_[i_31_] < i_38_) { + i_38_ = is_29_[i_31_]; + } + byte[] is_39_ = is_27_[i]; + byte[] is_40_ = is[i_31_]; + int i_41_ = i_36_ - i_32_; + int i_42_ = i_36_ - i_34_; + for (int i_43_ = i_36_; i_43_ < i_37_; i_43_++) { + int i_44_ = is_39_[i_41_++] + is_40_[i_42_++]; + if (i_44_ < i_38_) { + i_38_ = i_44_; + } + } + return -i_38_; + } + + public void drawCenteredStringMoveXY(String string, int drawX, int drawY, int color, int shadow, int randomMod) { + if (string != null) { + setColorAndShadow(color, shadow); + int[] xMods = new int[string.length()]; + int[] yMods = new int[string.length()]; + for (int index = 0; index < string.length(); index++) { + xMods[index] = (int) (Math.sin(index / 5.0 + randomMod / 5.0) * 5.0); + yMods[index] = (int) (Math.sin(index / 3.0 + randomMod / 5.0) * 5.0); + } + drawBaseStringMoveXY(string, drawX - getTextWidth(string) / 2, drawY, xMods, yMods); + } + } + + public void drawCenteredStringMoveY(String class100, int drawX, int drawY, int color, int shadow, int i_54_) { + if (class100 != null) { + setColorAndShadow(color, shadow); + int[] yOffset = new int[class100.length()]; + for (int index = 0; index < class100.length(); index++) { + yOffset[index] = (int) (Math.sin(index / 2.0 + i_54_ / 5.0) * 5.0); + } + drawBaseStringMoveXY(class100, drawX - getTextWidth(class100) / 2, drawY, null, yOffset); + } + } + + public static void unpackImages(Sprite[] icons, Sprite[] clan) { + chatImages = icons; + clanImages = clan; + } + + public void drawBasicString(String string, int drawX, int drawY) { + drawY -= baseCharacterHeight; + int startIndex = -1; + string = handleOldSyntax(string); + for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) { + int character = string.charAt(currentCharacter); + if (character > 255) { + character = 32; + } + if (character == 60) { + startIndex = currentCharacter; + } else { + if (character == 62 && startIndex != -1) { + String effectString = string.substring(startIndex + 1, currentCharacter); + startIndex = -1; + if (effectString.equals(startEffect)) { + character = 60; + } else if (effectString.equals(endEffect)) { + character = 62; + } else if (effectString.equals(aRSString_4135)) { + character = 160; + } else if (effectString.equals(aRSString_4162)) { + character = 173; + } else if (effectString.equals(aRSString_4165)) { + character = 215; + } else if (effectString.equals(aRSString_4147)) { + character = 128; + } else if (effectString.equals(aRSString_4163)) { + character = 169; + } else if (effectString.equals(aRSString_4169)) { + character = 174; + } else { + if (effectString.startsWith(startImage)) { + try { + int imageId = Integer.valueOf(effectString.substring(4)); + Sprite chatImageId = chatImages[imageId]; + int iconModY = chatImageId.maxHeight; + if (transparency == 256) { + chatImageId.method346(drawX, (drawY + baseCharacterHeight - iconModY)); + } else { + chatImageId.drawSprite(drawX, (drawY + baseCharacterHeight - iconModY), + transparency); + } + drawX += chatImageId.maxWidth; + } catch (Exception exception) { + /* empty */ + } + } else if (effectString.startsWith(startClanImage)) { + try { + int imageId = Integer.valueOf(effectString.substring(5)); + Sprite icon = clanImages[imageId]; + int iconModY = icon.myHeight + icon.drawOffsetY + 1; + if (transparency == 256) { + icon.drawSprite(drawX, (drawY + baseCharacterHeight - iconModY)); + } else { + icon.drawSprite(drawX, (drawY + baseCharacterHeight - iconModY), transparency); + } + drawX += 11; + } catch (Exception exception) { + exception.printStackTrace(); + } + } else { + setTextEffects(effectString); + } + continue; + } + } + if (startIndex == -1) { + int width = characterWidths[character]; + int height = characterHeights[character]; + if (character != 32) { + if (transparency == 256) { + if (textShadowColor != -1) { + drawCharacter(character, drawX + characterDrawXOffsets[character] + 1, + drawY + characterDrawYOffsets[character] + 1, width, height, textShadowColor, + true); + } + drawCharacter(character, drawX + characterDrawXOffsets[character], + drawY + characterDrawYOffsets[character], width, height, textColor, false); + } else { + if (textShadowColor != -1) { + drawTransparentCharacter(character, drawX + characterDrawXOffsets[character] + 1, + drawY + characterDrawYOffsets[character] + 1, width, height, textShadowColor, + transparency, true); + } + drawTransparentCharacter(character, drawX + characterDrawXOffsets[character], + drawY + characterDrawYOffsets[character], width, height, textColor, transparency, + false); + } + } else if (anInt4178 > 0) { + anInt4175 += anInt4178; + drawX += anInt4175 >> 8; + anInt4175 &= 0xff; + } + int lineWidth = characterScreenWidths[character]; + if (strikethroughColor != -1) { + Rasterizer2D.drawHorizontalLine(drawX, + drawY + (int) (baseCharacterHeight * 0.69999999999999996D), lineWidth, + strikethroughColor); + } + if (underlineColor != -1) { + Rasterizer2D.drawHorizontalLine(drawX, drawY + baseCharacterHeight, lineWidth, underlineColor); + } + drawX += lineWidth; + } + } + } + } + + public void drawRAString(String string, int drawX, int drawY, int color, int shadow) { + if (string != null) { + setColorAndShadow(color, shadow); + drawBasicString(string, drawX - getTextWidth(string), drawY); + } + } + + public void drawBaseStringMoveXY(String string, int drawX, int drawY, int[] xModifier, int[] yModifier) { + drawY -= baseCharacterHeight; + int startIndex = -1; + int modifierOffset = 0; + for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) { + int character = string.charAt(currentCharacter); + if (character == 60) { + startIndex = currentCharacter; + } else { + if (character == 62 && startIndex != -1) { + String effectString = string.substring(startIndex + 1, currentCharacter); + startIndex = -1; + if (effectString.equals(startEffect)) { + character = 60; + } else if (effectString.equals(endEffect)) { + character = 62; + } else if (effectString.equals(aRSString_4135)) { + character = 160; + } else if (effectString.equals(aRSString_4162)) { + character = 173; + } else if (effectString.equals(aRSString_4165)) { + character = 215; + } else if (effectString.equals(aRSString_4147)) { + character = 128; + } else if (effectString.equals(aRSString_4163)) { + character = 169; + } else if (effectString.equals(aRSString_4169)) { + character = 174; + } else { + if (effectString.startsWith(startImage)) { + try { + int xModI; + if (xModifier != null) { + xModI = xModifier[modifierOffset]; + } else { + xModI = 0; + } + int yMod; + if (yModifier != null) { + yMod = yModifier[modifierOffset]; + } else { + yMod = 0; + } + modifierOffset++; + int iconId = Integer.valueOf(effectString.substring(4)); + Sprite class92 = chatImages[iconId]; + int iconOffsetY = class92.maxHeight; + if (transparency == 256) { + class92.drawSprite(drawX + xModI, + (drawY + baseCharacterHeight - iconOffsetY + yMod)); + } else { + class92.drawSprite(drawX + xModI, + (drawY + baseCharacterHeight - iconOffsetY + yMod), transparency); + } + drawX += class92.maxWidth; + } catch (Exception exception) { + /* empty */ + } + } else { + setTextEffects(effectString); + } + continue; + } + } + if (startIndex == -1) { + int width = characterWidths[character]; + int height = characterHeights[character]; + int xOff; + if (xModifier != null) { + xOff = xModifier[modifierOffset]; + } else { + xOff = 0; + } + int yOff; + if (yModifier != null) { + yOff = yModifier[modifierOffset]; + } else { + yOff = 0; + } + modifierOffset++; + if (character != 32) { + if (transparency == 256) { + if (textShadowColor != -1) { + drawCharacter(character, (drawX + characterDrawXOffsets[character] + 1 + xOff), + (drawY + characterDrawYOffsets[character] + 1 + yOff), width, height, + textShadowColor, true); + } + drawCharacter(character, drawX + characterDrawXOffsets[character] + xOff, + drawY + characterDrawYOffsets[character] + yOff, width, height, textColor, false); + } else { + if (textShadowColor != -1) { + drawTransparentCharacter(character, + (drawX + characterDrawXOffsets[character] + 1 + xOff), + (drawY + characterDrawYOffsets[character] + 1 + yOff), width, height, + textShadowColor, transparency, true); + } + drawTransparentCharacter(character, drawX + characterDrawXOffsets[character] + xOff, + drawY + characterDrawYOffsets[character] + yOff, width, height, textColor, + transparency, false); + } + } else if (anInt4178 > 0) { + anInt4175 += anInt4178; + drawX += anInt4175 >> 8; + anInt4175 &= 0xff; + } + int i_109_ = characterScreenWidths[character]; + if (strikethroughColor != -1) { + Rasterizer2D.drawHorizontalLine(drawX, drawY + (int) (baseCharacterHeight * 0.7), i_109_, + strikethroughColor); + } + if (underlineColor != -1) { + Rasterizer2D.drawHorizontalLine(drawX, drawY + baseCharacterHeight, i_109_, underlineColor); + } + drawX += i_109_; + } + } + } + } + + public void setTextEffects(String string) { + do { + try { + if (string.startsWith(startColor)) { + String color = string.substring(4); + textColor = color.length() < 6 ? Color.decode(color).getRGB() : Integer.parseInt(color, 16); + } else if (string.equals(endColor)) { + textColor = defaultColor; + } else if (string.startsWith(startTransparency)) { + transparency = Integer.valueOf(string.substring(6)); + } else if (string.equals(endTransparency)) { + transparency = defaultTransparency; + } else if (string.startsWith(startStrikethrough)) { + strikethroughColor = Integer.valueOf(string.substring(4)); + } else if (string.equals(defaultStrikethrough)) { + strikethroughColor = 8388608; + } else if (string.equals(endStrikethrough)) { + strikethroughColor = -1; + } else if (string.startsWith(startUnderline)) { + underlineColor = Integer.valueOf(string.substring(2)); + } else if (string.equals(startDefaultUnderline)) { + underlineColor = 0; + } else if (string.equals(endUnderline)) { + underlineColor = -1; + } else if (string.startsWith(startShadow)) { + textShadowColor = Integer.valueOf(string.substring(5)); + } else if (string.equals(startDefaultShadow)) { + textShadowColor = 0; + } else if (string.equals(endShadow)) { + textShadowColor = defaultShadow; + } else { + if (!string.equals(lineBreak)) { + break; + } + setDefaultTextEffectValues(defaultColor, defaultShadow, defaultTransparency); + } + } catch (Exception exception) { + break; + } + break; + } while (false); } - public void setDefaultTextEffectValues(int color, int shadow, int trans) { - strikethroughColor = -1; - underlineColor = -1; - textShadowColor = defaultShadow = shadow; - textColor = defaultColor = color; - transparency = defaultTransparency = trans; - anInt4178 = 0; - anInt4175 = 0; - } - - public static int method1014(byte[][] is, byte[][] is_27_, int[] is_28_, - int[] is_29_, int[] is_30_, int i, - int i_31_) { - int i_32_ = is_28_[i]; - int i_33_ = i_32_ + is_30_[i]; - int i_34_ = is_28_[i_31_]; - int i_35_ = i_34_ + is_30_[i_31_]; - int i_36_ = i_32_; - if (i_34_ > i_32_) { - i_36_ = i_34_; - } - int i_37_ = i_33_; - if (i_35_ < i_33_) { - i_37_ = i_35_; - } - int i_38_ = is_29_[i]; - if (is_29_[i_31_] < i_38_) { - i_38_ = is_29_[i_31_]; - } - byte[] is_39_ = is_27_[i]; - byte[] is_40_ = is[i_31_]; - int i_41_ = i_36_ - i_32_; - int i_42_ = i_36_ - i_34_; - for (int i_43_ = i_36_; i_43_ < i_37_; i_43_++) { - int i_44_ = is_39_[i_41_++] + is_40_[i_42_++]; - if (i_44_ < i_38_) { - i_38_ = i_44_; - } - } - return -i_38_; - } - - public void drawCenteredStringMoveXY(String string, int drawX, int drawY, int color, - int shadow, int randomMod) { - if (string != null) { - setColorAndShadow(color, shadow); - int[] xMods = new int[string.length()]; - int[] yMods = new int[string.length()]; - for (int index = 0; index < string.length(); index++) { - xMods[index] = (int) (Math.sin((double) index / 5.0 + (double) randomMod / 5.0) * 5.0); - yMods[index] = (int) (Math.sin((double) index / 3.0 + (double) randomMod / 5.0) * 5.0); - } - drawBaseStringMoveXY(string, drawX - getTextWidth(string) / 2, drawY, xMods, - yMods); - } - } - - public void drawCenteredStringMoveY(String class100, int drawX, int drawY, int color, - int shadow, int i_54_) { - if (class100 != null) { - setColorAndShadow(color, shadow); - int[] yOffset = new int[class100.length()]; - for (int index = 0; index < class100.length(); index++) { - yOffset[index] = (int) (Math.sin((double) index / 2.0 + (double) i_54_ / 5.0) * 5.0); - } - drawBaseStringMoveXY(class100, drawX - getTextWidth(class100) / 2, drawY, null, - yOffset); - } - } - - public static void unpackImages(Sprite[] icons, Sprite[] clan) { - chatImages = icons; - clanImages = clan; - } - - public void drawBasicString(String string, int drawX, int drawY) { - drawY -= baseCharacterHeight; - int startIndex = -1; - string = handleOldSyntax(string); - for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) { - int character = string.charAt(currentCharacter); - if (character > 255) { - character = 32; - } - if (character == 60) { - startIndex = currentCharacter; - } else { - if (character == 62 && startIndex != -1) { - String effectString = string.substring(startIndex + 1, currentCharacter); - startIndex = -1; - if (effectString.equals(startEffect)) { - character = 60; - } else if (effectString.equals(endEffect)) { - character = 62; - } else if (effectString.equals(aRSString_4135)) { - character = 160; - } else if (effectString.equals(aRSString_4162)) { - character = 173; - } else if (effectString.equals(aRSString_4165)) { - character = 215; - } else if (effectString.equals(aRSString_4147)) { - character = 128; - } else if (effectString.equals(aRSString_4163)) { - character = 169; - } else if (effectString.equals(aRSString_4169)) { - character = 174; - } else { - if (effectString.startsWith(startImage)) { - try { - int imageId = Integer.valueOf(effectString.substring(4)); - Sprite chatImageId = chatImages[imageId]; - int iconModY = chatImageId.maxHeight; - if (transparency == 256) { - chatImageId.method346(drawX, (drawY + baseCharacterHeight - iconModY)); - } else { - chatImageId.drawSprite(drawX,(drawY + baseCharacterHeight - iconModY), transparency); - } - drawX += chatImageId.maxWidth; - } catch (Exception exception) { - /* empty */ - } - } else if (effectString.startsWith(startClanImage)) { - try { - int imageId = Integer.valueOf(effectString - .substring(5)); - Sprite icon = clanImages[imageId]; - int iconModY = icon.myHeight + icon.drawOffsetY - + 1; - if (transparency == 256) { - icon.drawSprite(drawX, (drawY - + baseCharacterHeight - iconModY)); - } else { - icon.drawSprite(drawX, (drawY - + baseCharacterHeight - iconModY), - transparency); - } - drawX += 11; - } catch (Exception exception) { - exception.printStackTrace(); - } - } else { - setTextEffects(effectString); - } - continue; - } - } - if (startIndex == -1) { - int width = characterWidths[character]; - int height = characterHeights[character]; - if (character != 32) { - if (transparency == 256) { - if (textShadowColor != -1) { - drawCharacter(character, - drawX + characterDrawXOffsets[character] + 1, - drawY + characterDrawYOffsets[character] + 1, - width, height, textShadowColor, true); - } - drawCharacter(character, drawX + characterDrawXOffsets[character], - drawY + characterDrawYOffsets[character], width, - height, textColor, false); - } else { - if (textShadowColor != -1) { - drawTransparentCharacter(character, - drawX + characterDrawXOffsets[character] + 1, - drawY + characterDrawYOffsets[character] + 1, - width, height, textShadowColor, transparency, - true); - } - drawTransparentCharacter(character, drawX + characterDrawXOffsets[character], - drawY + characterDrawYOffsets[character], width, - height, textColor, transparency, false); - } - } else if (anInt4178 > 0) { - anInt4175 += anInt4178; - drawX += anInt4175 >> 8; - anInt4175 &= 0xff; - } - int lineWidth = characterScreenWidths[character]; - if (strikethroughColor != -1) { - GameFont.drawHorizontalLine(drawX, drawY + (int) ((double) baseCharacterHeight * 0.69999999999999996D), lineWidth, strikethroughColor); - } - if (underlineColor != -1) { - GameFont.drawHorizontalLine(drawX, drawY + baseCharacterHeight, lineWidth, underlineColor); - } - drawX += lineWidth; - } - } - } - } - - public void drawRAString(String string, int drawX, int drawY, int color, - int shadow) { - if (string != null) { - setColorAndShadow(color, shadow); - drawBasicString(string, drawX - getTextWidth(string), drawY); - } - } - - public void drawBaseStringMoveXY(String string, int drawX, int drawY, int[] xModifier, - int[] yModifier) { - drawY -= baseCharacterHeight; - int startIndex = -1; - int modifierOffset = 0; - for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) { - int character = string.charAt(currentCharacter); - if (character == 60) { - startIndex = currentCharacter; - } else { - if (character == 62 && startIndex != -1) { - String effectString = string.substring(startIndex + 1, currentCharacter); - startIndex = -1; - if (effectString.equals(startEffect)) { - character = 60; - } else if (effectString.equals(endEffect)) { - character = 62; - } else if (effectString.equals(aRSString_4135)) { - character = 160; - } else if (effectString.equals(aRSString_4162)) { - character = 173; - } else if (effectString.equals(aRSString_4165)) { - character = 215; - } else if (effectString.equals(aRSString_4147)) { - character = 128; - } else if (effectString.equals(aRSString_4163)) { - character = 169; - } else if (effectString.equals(aRSString_4169)) { - character = 174; - } else { - if (effectString.startsWith(startImage)) { - try { - int xModI; - if (xModifier != null) { - xModI = xModifier[modifierOffset]; - } else { - xModI = 0; - } - int yMod; - if (yModifier != null) { - yMod = yModifier[modifierOffset]; - } else { - yMod = 0; - } - modifierOffset++; - int iconId = Integer.valueOf(effectString.substring(4)); - Sprite class92 = chatImages[iconId]; - int iconOffsetY = class92.maxHeight; - if (transparency == 256) { - class92.drawSprite(drawX + xModI, - (drawY + baseCharacterHeight - iconOffsetY + yMod)); - } else { - class92.drawSprite(drawX + xModI, - (drawY + baseCharacterHeight - iconOffsetY + yMod), - transparency); - } - drawX += class92.maxWidth; - } catch (Exception exception) { - /* empty */ - } - } else { - setTextEffects(effectString); - } - continue; - } - } - if (startIndex == -1) { - int width = characterWidths[character]; - int height = characterHeights[character]; - int xOff; - if (xModifier != null) { - xOff = xModifier[modifierOffset]; - } else { - xOff = 0; - } - int yOff; - if (yModifier != null) { - yOff = yModifier[modifierOffset]; - } else { - yOff = 0; - } - modifierOffset++; - if (character != 32) { - if (transparency == 256) { - if (textShadowColor != -1) { - drawCharacter(character, - (drawX + characterDrawXOffsets[character] + 1 + xOff), - (drawY + characterDrawYOffsets[character] + 1 + yOff), - width, height, textShadowColor, true); - } - drawCharacter(character, - drawX + characterDrawXOffsets[character] + xOff, - drawY + characterDrawYOffsets[character] + yOff, - width, height, textColor, false); - } else { - if (textShadowColor != -1) { - drawTransparentCharacter(character, - (drawX + characterDrawXOffsets[character] + 1 + xOff), - (drawY + characterDrawYOffsets[character] + 1 + yOff), - width, height, textShadowColor, - transparency, true); - } - drawTransparentCharacter(character, - drawX + characterDrawXOffsets[character] + xOff, - drawY + characterDrawYOffsets[character] + yOff, - width, height, textColor, transparency, - false); - } - } else if (anInt4178 > 0) { - anInt4175 += anInt4178; - drawX += anInt4175 >> 8; - anInt4175 &= 0xff; - } - int i_109_ = characterScreenWidths[character]; - if (strikethroughColor != -1) { - GameFont.drawHorizontalLine(drawX, drawY + (int) ((double) baseCharacterHeight * 0.7), i_109_, strikethroughColor); - } - if (underlineColor != -1) { - GameFont.drawHorizontalLine(drawX, drawY + baseCharacterHeight, i_109_, underlineColor); - } - drawX += i_109_; - } - } - } - } - - public void setTextEffects(String string) { - do { - try { - if (string.startsWith(startColor)) { - String color = string.substring(4); - textColor = color.length() < 6 ? Color.decode(color).getRGB() : Integer.parseInt(color, 16); - } else if (string.equals(endColor)) { - textColor = defaultColor; - } else if (string.startsWith(startTransparency)) { - transparency = Integer.valueOf(string.substring(6)); - } else if (string.equals(endTransparency)) { - transparency = defaultTransparency; - } else if (string.startsWith(startStrikethrough)) { - strikethroughColor = Integer.valueOf(string.substring(4)); - } else if (string.equals(defaultStrikethrough)) { - strikethroughColor = 8388608; - } else if (string.equals(endStrikethrough)) { - strikethroughColor = -1; - } else if (string.startsWith(startUnderline)) { - underlineColor = Integer.valueOf(string.substring(2)); - } else if (string.equals(startDefaultUnderline)) { - underlineColor = 0; - } else if (string.equals(endUnderline)) { - underlineColor = -1; - } else if (string.startsWith(startShadow)) { - textShadowColor = Integer.valueOf(string.substring(5)); - } else if (string.equals(startDefaultShadow)) { - textShadowColor = 0; - } else if (string.equals(endShadow)) { - textShadowColor = defaultShadow; - } else { - if (!string.equals(lineBreak)) { - break; - } - setDefaultTextEffectValues(defaultColor, defaultShadow, defaultTransparency); - } - } catch (Exception exception) { - break; - } - break; - } while (false); - } - - public void setColorAndShadow(int color, int shadow) { - strikethroughColor = -1; - underlineColor = -1; - textShadowColor = defaultShadow = shadow; - textColor = defaultColor = color; - transparency = defaultTransparency = 256; - anInt4178 = 0; - anInt4175 = 0; - } - - public int getTextWidth(String string) { - if (string == null) { - return 0; - } - int startIndex = -1; - int finalWidth = 0; - for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) { - int character = string.charAt(currentCharacter); - if (character > 255) { - character = 32; - } - if (character == 60) { - startIndex = currentCharacter; - } else { - if (character == 62 && startIndex != -1) { - String effectString = string.substring(startIndex + 1, currentCharacter); - startIndex = -1; - if (effectString.equals(startEffect)) { - character = 60; - } else if (effectString.equals(endEffect)) { - character = 62; - } else if (effectString.equals(aRSString_4135)) { - character = 160; - } else if (effectString.equals(aRSString_4162)) { - character = 173; - } else if (effectString.equals(aRSString_4165)) { - character = 215; - } else if (effectString.equals(aRSString_4147)) { - character = 128; - } else if (effectString.equals(aRSString_4163)) { - character = 169; - } else if (effectString.equals(aRSString_4169)) { - character = 174; - } else { - if (effectString.startsWith(startImage)) { - try {//> 8; - i_7_ = 256 - i_7_; - for (int i_8_ = -i_4_; i_8_ < 0; i_8_++) { - for (int i_9_ = -i_3_; i_9_ < 0; i_9_++) { - if (is_0_[i_1_++] != 0) { - int i_10_ = is[i_2_]; - is[i_2_++] = ((((i_10_ & 0xff00ff) * i_7_ & ~0xff00ff) + ((i_10_ & 0xff00) * i_7_ & 0xff0000)) >> 8) + i; - } else { - i_2_++; - } - } - i_2_ += i_5_; - i_1_ += i_6_; - } - } - - public void drawTransparentCharacter(int i, int i_11_, int i_12_, int i_13_, int i_14_, - int i_15_, int i_16_, boolean bool) { - int i_17_ = i_11_ + i_12_ * Rasterizer2D.width; - int i_18_ = Rasterizer2D.width - i_13_; - int i_19_ = 0; - int i_20_ = 0; - if (i_12_ < Rasterizer2D.topY) { - int i_21_ = Rasterizer2D.topY - i_12_; - i_14_ -= i_21_; - i_12_ = Rasterizer2D.topY; - i_20_ += i_21_ * i_13_; - i_17_ += i_21_ * Rasterizer2D.width; - } - if (i_12_ + i_14_ > Rasterizer2D.bottomY) { - i_14_ -= i_12_ + i_14_ - Rasterizer2D.bottomY; - } - if (i_11_ < Rasterizer2D.leftX) { - int i_22_ = Rasterizer2D.leftX - i_11_; - i_13_ -= i_22_; - i_11_ = Rasterizer2D.leftX; - i_20_ += i_22_; - i_17_ += i_22_; - i_19_ += i_22_; - i_18_ += i_22_; - } - if (i_11_ + i_13_ > Rasterizer2D.bottomX) { - int i_23_ = i_11_ + i_13_ - Rasterizer2D.bottomX; - i_13_ -= i_23_; - i_19_ += i_23_; - i_18_ += i_23_; - } - if (i_13_ > 0 && i_14_ > 0) { - createTransparentCharacterPixels(Rasterizer2D.pixels, fontPixels[i], i_15_ ,i_20_, i_17_, i_13_, i_14_, i_18_, i_19_, i_16_); - } - } - - public static void createCharacterPixels(int[] is, byte[] is_24_, int i, int i_25_, - int i_26_, int i_27_, int i_28_, int i_29_, - int i_30_) { - int i_31_ = -(i_27_ >> 2); - i_27_ = -(i_27_ & 0x3); - for (int i_32_ = -i_28_; i_32_ < 0; i_32_++) { - for (int i_33_ = i_31_; i_33_ < 0; i_33_++) { - if (is_24_[i_25_++] != 0) { - is[i_26_++] = i; - } else { - i_26_++; - } - if (is_24_[i_25_++] != 0) { - is[i_26_++] = i; - } else { - i_26_++; - } - if (is_24_[i_25_++] != 0) { - is[i_26_++] = i; - } else { - i_26_++; - } - if (is_24_[i_25_++] != 0) { - is[i_26_++] = i; - } else { - i_26_++; - } - } - for (int i_34_ = i_27_; i_34_ < 0; i_34_++) { - if (is_24_[i_25_++] != 0) { - is[i_26_++] = i; - } else { - i_26_++; - } - } - i_26_ += i_29_; - i_25_ += i_30_; - } - } - - public static String handleOldSyntax(String text) { - text = text.replaceAll("@red@", ""); - text = text.replaceAll("@gre@", ""); - text = text.replaceAll("@blu@", ""); - text = text.replaceAll("@yel@", ""); - text = text.replaceAll("@cya@", ""); - text = text.replaceAll("@mag@", ""); - text = text.replaceAll("@whi@", ""); - text = text.replaceAll("@lre@", ""); - text = text.replaceAll("@dre@", ""); - text = text.replaceAll("@bla@", ""); - text = text.replaceAll("@or1@", ""); - text = text.replaceAll("@or2@", ""); - text = text.replaceAll("@or3@", ""); - text = text.replaceAll("@gr1@", ""); - text = text.replaceAll("@gr2@", ""); - text = text.replaceAll("@gr3@", ""); - text = text.replaceAll("@RED@", ""); - text = text.replaceAll("@GRE@", ""); - text = text.replaceAll("@BLU@", ""); - text = text.replaceAll("@YEL@", ""); - text = text.replaceAll("@CYA@", ""); - text = text.replaceAll("@MAG@", ""); - text = text.replaceAll("@WHI@", ""); - text = text.replaceAll("@LRE@", ""); - text = text.replaceAll("@DRE@", ""); - text = text.replaceAll("@BLA@", ""); - text = text.replaceAll("@OR1@", ""); - text = text.replaceAll("@OR2@", ""); - text = text.replaceAll("@OR3@", ""); - text = text.replaceAll("@GR1@", ""); - text = text.replaceAll("@GR2@", ""); - text = text.replaceAll("@GR3@", ""); - text = text.replaceAll("@cr1@", ""); - text = text.replaceAll("@cr2@", ""); - text = text.replaceAll("@cr3@", ""); - text = text.replaceAll("@cr4@", ""); - text = text.replaceAll("@cr5@", ""); - text = text.replaceAll("@cr6@", ""); - return text; - } - - public void drawCharacter(int character, int i_35_, int i_36_, int i_37_, int i_38_, - int i_39_, boolean bool) { - int i_40_ = i_35_ + i_36_ * Rasterizer2D.width; - int i_41_ = Rasterizer2D.width - i_37_; - int i_42_ = 0; - int i_43_ = 0; - if (i_36_ < Rasterizer2D.topY) { - int i_44_ = Rasterizer2D.topY - i_36_; - i_38_ -= i_44_; - i_36_ = Rasterizer2D.topY; - i_43_ += i_44_ * i_37_; - i_40_ += i_44_ * Rasterizer2D.width; - } - if (i_36_ + i_38_ > Rasterizer2D.bottomY) { - i_38_ -= i_36_ + i_38_ - Rasterizer2D.bottomY; - } - if (i_35_ < Rasterizer2D.leftX) { - int i_45_ = Rasterizer2D.leftX - i_35_; - i_37_ -= i_45_; - i_35_ = Rasterizer2D.leftX; - i_43_ += i_45_; - i_40_ += i_45_; - i_42_ += i_45_; - i_41_ += i_45_; - } - if (i_35_ + i_37_ > Rasterizer2D.bottomX) { - int i_46_ = i_35_ + i_37_ - Rasterizer2D.bottomX; - i_37_ -= i_46_; - i_42_ += i_46_; - i_41_ += i_46_; - } - if (i_37_ > 0 && i_38_ > 0) { - createCharacterPixels(Rasterizer2D.pixels, fontPixels[character], - i_39_, i_43_, i_40_, i_37_, i_38_, i_41_, i_42_); - - } - } - - static { - startTransparency = "trans="; - startStrikethrough = "str="; - startDefaultShadow = "shad"; - startColor = "col="; - lineBreak = "br"; - defaultStrikethrough = "str"; - endUnderline = "/u"; - startImage = "img="; - startClanImage = "clan="; - startShadow = "shad="; - startUnderline = "u="; - endColor = "/col"; - startDefaultUnderline = "u"; - endTransparency = "/trans"; - aRSString_4143 = Integer.toString(100); - aRSString_4135 = "nbsp"; - aRSString_4169 = "reg"; - aRSString_4165 = "times"; - aRSString_4162 = "shy"; - aRSString_4163 = "copy"; - endEffect = "gt"; - aRSString_4147 = "euro"; - startEffect = "lt"; - defaultTransparency = 256; - defaultShadow = -1; - anInt4175 = 0; - textShadowColor = -1; - textColor = 0; - defaultColor = 0; - strikethroughColor = -1; - splitTextStrings = new String[100]; - underlineColor = -1; - anInt4178 = 0; - transparency = 256; - } + public void setColorAndShadow(int color, int shadow) { + strikethroughColor = -1; + underlineColor = -1; + textShadowColor = defaultShadow = shadow; + textColor = defaultColor = color; + transparency = defaultTransparency = 256; + anInt4178 = 0; + anInt4175 = 0; + } + + public int getTextWidth(String string) { + if (string == null) { + return 0; + } + int startIndex = -1; + int finalWidth = 0; + for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) { + int character = string.charAt(currentCharacter); + if (character > 255) { + character = 32; + } + if (character == 60) { + startIndex = currentCharacter; + } else { + if (character == 62 && startIndex != -1) { + String effectString = string.substring(startIndex + 1, currentCharacter); + startIndex = -1; + if (effectString.equals(startEffect)) { + character = 60; + } else if (effectString.equals(endEffect)) { + character = 62; + } else if (effectString.equals(aRSString_4135)) { + character = 160; + } else if (effectString.equals(aRSString_4162)) { + character = 173; + } else if (effectString.equals(aRSString_4165)) { + character = 215; + } else if (effectString.equals(aRSString_4147)) { + character = 128; + } else if (effectString.equals(aRSString_4163)) { + character = 169; + } else if (effectString.equals(aRSString_4169)) { + character = 174; + } else { + if (effectString.startsWith(startImage)) { + try {// > 8; + i_7_ = 256 - i_7_; + for (int i_8_ = -i_4_; i_8_ < 0; i_8_++) { + for (int i_9_ = -i_3_; i_9_ < 0; i_9_++) { + if (is_0_[i_1_++] != 0) { + int i_10_ = is[i_2_]; + is[i_2_++] = ((((i_10_ & 0xff00ff) * i_7_ & ~0xff00ff) + ((i_10_ & 0xff00) * i_7_ & 0xff0000)) >> 8) + + i; + } else { + i_2_++; + } + } + i_2_ += i_5_; + i_1_ += i_6_; + } + } + + public void drawTransparentCharacter(int i, int i_11_, int i_12_, int i_13_, int i_14_, int i_15_, int i_16_, + boolean bool) { + int i_17_ = i_11_ + i_12_ * Rasterizer2D.width; + int i_18_ = Rasterizer2D.width - i_13_; + int i_19_ = 0; + int i_20_ = 0; + if (i_12_ < Rasterizer2D.topY) { + int i_21_ = Rasterizer2D.topY - i_12_; + i_14_ -= i_21_; + i_12_ = Rasterizer2D.topY; + i_20_ += i_21_ * i_13_; + i_17_ += i_21_ * Rasterizer2D.width; + } + if (i_12_ + i_14_ > Rasterizer2D.bottomY) { + i_14_ -= i_12_ + i_14_ - Rasterizer2D.bottomY; + } + if (i_11_ < Rasterizer2D.leftX) { + int i_22_ = Rasterizer2D.leftX - i_11_; + i_13_ -= i_22_; + i_11_ = Rasterizer2D.leftX; + i_20_ += i_22_; + i_17_ += i_22_; + i_19_ += i_22_; + i_18_ += i_22_; + } + if (i_11_ + i_13_ > Rasterizer2D.bottomX) { + int i_23_ = i_11_ + i_13_ - Rasterizer2D.bottomX; + i_13_ -= i_23_; + i_19_ += i_23_; + i_18_ += i_23_; + } + if (i_13_ > 0 && i_14_ > 0) { + createTransparentCharacterPixels(Rasterizer2D.pixels, fontPixels[i], i_15_, i_20_, i_17_, i_13_, i_14_, + i_18_, i_19_, i_16_); + } + } + + public static void createCharacterPixels(int[] is, byte[] is_24_, int i, int i_25_, int i_26_, int i_27_, int i_28_, + int i_29_, int i_30_) { + int i_31_ = -(i_27_ >> 2); + i_27_ = -(i_27_ & 0x3); + for (int i_32_ = -i_28_; i_32_ < 0; i_32_++) { + for (int i_33_ = i_31_; i_33_ < 0; i_33_++) { + if (is_24_[i_25_++] != 0) { + is[i_26_++] = i; + } else { + i_26_++; + } + if (is_24_[i_25_++] != 0) { + is[i_26_++] = i; + } else { + i_26_++; + } + if (is_24_[i_25_++] != 0) { + is[i_26_++] = i; + } else { + i_26_++; + } + if (is_24_[i_25_++] != 0) { + is[i_26_++] = i; + } else { + i_26_++; + } + } + for (int i_34_ = i_27_; i_34_ < 0; i_34_++) { + if (is_24_[i_25_++] != 0) { + is[i_26_++] = i; + } else { + i_26_++; + } + } + i_26_ += i_29_; + i_25_ += i_30_; + } + } + + public static String handleOldSyntax(String text) { + text = text.replaceAll("@red@", ""); + text = text.replaceAll("@gre@", ""); + text = text.replaceAll("@blu@", ""); + text = text.replaceAll("@yel@", ""); + text = text.replaceAll("@cya@", ""); + text = text.replaceAll("@mag@", ""); + text = text.replaceAll("@whi@", ""); + text = text.replaceAll("@lre@", ""); + text = text.replaceAll("@dre@", ""); + text = text.replaceAll("@bla@", ""); + text = text.replaceAll("@or1@", ""); + text = text.replaceAll("@or2@", ""); + text = text.replaceAll("@or3@", ""); + text = text.replaceAll("@gr1@", ""); + text = text.replaceAll("@gr2@", ""); + text = text.replaceAll("@gr3@", ""); + text = text.replaceAll("@RED@", ""); + text = text.replaceAll("@GRE@", ""); + text = text.replaceAll("@BLU@", ""); + text = text.replaceAll("@YEL@", ""); + text = text.replaceAll("@CYA@", ""); + text = text.replaceAll("@MAG@", ""); + text = text.replaceAll("@WHI@", ""); + text = text.replaceAll("@LRE@", ""); + text = text.replaceAll("@DRE@", ""); + text = text.replaceAll("@BLA@", ""); + text = text.replaceAll("@OR1@", ""); + text = text.replaceAll("@OR2@", ""); + text = text.replaceAll("@OR3@", ""); + text = text.replaceAll("@GR1@", ""); + text = text.replaceAll("@GR2@", ""); + text = text.replaceAll("@GR3@", ""); + text = text.replaceAll("@cr1@", ""); + text = text.replaceAll("@cr2@", ""); + text = text.replaceAll("@cr3@", ""); + text = text.replaceAll("@cr4@", ""); + text = text.replaceAll("@cr5@", ""); + text = text.replaceAll("@cr6@", ""); + return text; + } + + public void drawCharacter(int character, int i_35_, int i_36_, int i_37_, int i_38_, int i_39_, boolean bool) { + int i_40_ = i_35_ + i_36_ * Rasterizer2D.width; + int i_41_ = Rasterizer2D.width - i_37_; + int i_42_ = 0; + int i_43_ = 0; + if (i_36_ < Rasterizer2D.topY) { + int i_44_ = Rasterizer2D.topY - i_36_; + i_38_ -= i_44_; + i_36_ = Rasterizer2D.topY; + i_43_ += i_44_ * i_37_; + i_40_ += i_44_ * Rasterizer2D.width; + } + if (i_36_ + i_38_ > Rasterizer2D.bottomY) { + i_38_ -= i_36_ + i_38_ - Rasterizer2D.bottomY; + } + if (i_35_ < Rasterizer2D.leftX) { + int i_45_ = Rasterizer2D.leftX - i_35_; + i_37_ -= i_45_; + i_35_ = Rasterizer2D.leftX; + i_43_ += i_45_; + i_40_ += i_45_; + i_42_ += i_45_; + i_41_ += i_45_; + } + if (i_35_ + i_37_ > Rasterizer2D.bottomX) { + int i_46_ = i_35_ + i_37_ - Rasterizer2D.bottomX; + i_37_ -= i_46_; + i_42_ += i_46_; + i_41_ += i_46_; + } + if (i_37_ > 0 && i_38_ > 0) { + createCharacterPixels(Rasterizer2D.pixels, fontPixels[character], i_39_, i_43_, i_40_, i_37_, i_38_, i_41_, + i_42_); + + } + } + + static { + startTransparency = "trans="; + startStrikethrough = "str="; + startDefaultShadow = "shad"; + startColor = "col="; + lineBreak = "br"; + defaultStrikethrough = "str"; + endUnderline = "/u"; + startImage = "img="; + startClanImage = "clan="; + startShadow = "shad="; + startUnderline = "u="; + endColor = "/col"; + startDefaultUnderline = "u"; + endTransparency = "/trans"; + aRSString_4143 = Integer.toString(100); + aRSString_4135 = "nbsp"; + aRSString_4169 = "reg"; + aRSString_4165 = "times"; + aRSString_4162 = "shy"; + aRSString_4163 = "copy"; + endEffect = "gt"; + aRSString_4147 = "euro"; + startEffect = "lt"; + defaultTransparency = 256; + defaultShadow = -1; + anInt4175 = 0; + textShadowColor = -1; + textColor = 0; + defaultColor = 0; + strikethroughColor = -1; + splitTextStrings = new String[100]; + underlineColor = -1; + anInt4178 = 0; + transparency = 256; + } } \ No newline at end of file diff --git a/Elvarg - Client/src/org/seven/scene/graphic/Fog.java b/Elvarg - Client/src/org/seven/scene/graphic/Fog.java deleted file mode 100644 index 56d6347..0000000 --- a/Elvarg - Client/src/org/seven/scene/graphic/Fog.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.seven.scene.graphic; -import com.runescape.draw.Rasterizer2D; -import com.runescape.draw.Rasterizer3D; - -public class Fog { - /** - * Grabs distance from player. - */ - private float fogDistance; - - /** - * Sets the fog color. - */ - public static int setColor = 0xA7C5C7; - - /** - * - * @param fogStartDistance - * @param fogEndDistance - * @param fogIntensity - */ - public void renderFog(boolean belowGround, int fogStartDistance, int fogEndDistance, int fogIntensity) { - getColor(setColor); - int pos = Rasterizer3D.scanOffsets[0]; - int src, dst, alpha; - int fogBegin = (int) (fogStartDistance + fogDistance); - int fogEnd = (int) (fogEndDistance + fogDistance); - for (int y = 0; y < Rasterizer2D.bottomY; y++) { - for (int x = 0; x < Rasterizer2D.lastX; x++) { - if (Rasterizer2D.depthBuffer[pos] >= fogEnd) { - Rasterizer2D.pixels[pos] = setColor; - } else if (Rasterizer2D.depthBuffer[pos] >= fogBegin) { - alpha = (int)(Rasterizer2D.depthBuffer[pos] - fogBegin) / fogIntensity; - src = ((setColor & 0xff00ff) * alpha >> 8 & 0xff00ff) + ((setColor & 0xff00) * alpha >> 8 & 0xff00); - alpha = 256 - alpha; - dst = Rasterizer2D.pixels[pos]; - dst = ((dst & 0xff00ff) * alpha >> 8 & 0xff00ff) + ((dst & 0xff00) * alpha >> 8 & 0xff00); - Rasterizer2D.pixels[pos] = src + dst; - } - pos++; - } - pos += Rasterizer2D.width - Rasterizer2D.lastX; - } - } - - /** - * - * @param fogDistance - */ - public void setFogDistance(float fogDistance) { - this.fogDistance = fogDistance; - } - - /** - * - * @param fogColor - */ - public void getColor(int fogColor) { - setColor = fogColor; - } -} diff --git a/Elvarg - Client/src/org/seven/util/CacheUtils.java b/Elvarg - Client/src/org/seven/util/CacheUtils.java index 04b034f..600e8e4 100644 --- a/Elvarg - Client/src/org/seven/util/CacheUtils.java +++ b/Elvarg - Client/src/org/seven/util/CacheUtils.java @@ -12,75 +12,73 @@ public final class CacheUtils { - public static void repackCacheIndex(Client client, Store cacheIndex) { - System.out.println("Started repacking index " + cacheIndex.getIndex() + "."); - int indexLength = new File(SignLink.indexLocation(cacheIndex.getIndex(), -1)).listFiles().length; - File[] file = new File(SignLink.indexLocation(cacheIndex.getIndex(), -1)).listFiles(); - try { - for (int index = 0; index < indexLength; index++) { - int fileIndex = Integer.parseInt( - getFileNameWithoutExtension(file[index].toString())); - byte[] data = FileUtils.fileToByteArray(cacheIndex.getIndex(), fileIndex); - if (data != null && data.length > 0) { - client.indices[cacheIndex.getIndex()].writeFile(data.length, data, fileIndex); - System.out.println("Repacked " + fileIndex + "."); - } else { - System.out.println("Unable to locate index " + fileIndex + "."); - } - } - } catch (Exception ex) { - System.out.println("Error packing cache index " + cacheIndex.getIndex() + "."); - } - System.out.println("Finished repacking " + cacheIndex.getIndex() + "."); - } - + public static void repackCacheIndex(Client client, Store cacheIndex) { + System.out.println("Started repacking index " + cacheIndex.getIndex() + "."); + int indexLength = new File(SignLink.indexLocation(cacheIndex.getIndex(), -1)).listFiles().length; + File[] file = new File(SignLink.indexLocation(cacheIndex.getIndex(), -1)).listFiles(); + try { + for (int index = 0; index < indexLength; index++) { + int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString())); + byte[] data = FileUtils.fileToByteArray(cacheIndex.getIndex(), fileIndex); + if (data != null && data.length > 0) { + client.indices[cacheIndex.getIndex()].writeFile(data.length, data, fileIndex); + System.out.println("Repacked " + fileIndex + "."); + } else { + System.out.println("Unable to locate index " + fileIndex + "."); + } + } + } catch (Exception ex) { + System.out.println("Error packing cache index " + cacheIndex.getIndex() + "."); + } + System.out.println("Finished repacking " + cacheIndex.getIndex() + "."); + } + public static String getFileNameWithoutExtension(String fileName) { - File tmpFile = new File(fileName); - tmpFile.getName(); - int whereDot = tmpFile.getName().lastIndexOf('.'); - if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) { - return tmpFile.getName().substring(0, whereDot); - } - return ""; - } + File tmpFile = new File(fileName); + tmpFile.getName(); + int whereDot = tmpFile.getName().lastIndexOf('.'); + if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) { + return tmpFile.getName().substring(0, whereDot); + } + return ""; + } + + public static void dumpCacheIndex(Client client, Store cacheIndex) { + try { + for (int i = 0;; i++) { + try { + byte[] indexByteArray = client.indices[cacheIndex.getIndex()].decompress(i); + if (indexByteArray == null) { + System.out.println( + "Finished dumping index " + cacheIndex.getIndex() + ", exiting dump operation."); + break; + } + + final File dir = new File("./dump" + cacheIndex.getIndex() + "/"); + + if (!dir.exists()) { + dir.mkdirs(); + } + + BufferedOutputStream gzip = new BufferedOutputStream(new GZIPOutputStream( + new FileOutputStream("./dump" + cacheIndex.getIndex() + "/" + i + ".gz"))); - public static void dumpCacheIndex(Client client, Store cacheIndex) { - try { - for (int i = 0;; i++) { - try { - byte[] indexByteArray = client.indices[cacheIndex.getIndex()].decompress(i); - if (indexByteArray == null) { - System.out.println("Finished dumping index " + cacheIndex.getIndex() - + ", exiting dump operation."); - break; - } - - final File dir = new File("./dump" + cacheIndex.getIndex() + "/"); - - if (!dir.exists()) { - dir.mkdirs(); - } - - BufferedOutputStream gzip = new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream("./dump" + cacheIndex.getIndex() + "/" + i + ".gz"))); - - if (indexByteArray.length == 0) { - continue; - } else { - gzip.write(indexByteArray); - System.out.println("Unpacked " + i + "."); - gzip.close(); + if (indexByteArray.length == 0) { + continue; + } else { + gzip.write(indexByteArray); + System.out.println("Unpacked " + i + "."); + gzip.close(); - } - } catch (IOException ex) { - throw new IOException( - "Error writing to folder. Ensure you have this directory created: '" - + "./dump" - + cacheIndex.getIndex() + "'"); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } + } + } catch (IOException ex) { + throw new IOException("Error writing to folder. Ensure you have this directory created: '" + + "./dump" + cacheIndex.getIndex() + "'"); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/Elvarg - Client/src/org/seven/util/FileUtils.java b/Elvarg - Client/src/org/seven/util/FileUtils.java index 4702775..7ea8a0f 100644 --- a/Elvarg - Client/src/org/seven/util/FileUtils.java +++ b/Elvarg - Client/src/org/seven/util/FileUtils.java @@ -28,175 +28,176 @@ import com.runescape.sign.SignLink; -public final class FileUtils { - - public static BufferedImage imageToBufferedImage(Image image) { - BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); - Graphics2D g2 = bufferedImage.createGraphics(); - g2.drawImage(image, 0, 0, null); - g2.dispose(); - return bufferedImage; - } - - /** - * Converts an array of bytes to a {@link BufferedImage}. - * - * @param data - * The array of pixels. - * - * @return The newly created image. - */ - public static BufferedImage byteArrayToImage(byte[] data) throws IOException { - ByteArrayInputStream in = new ByteArrayInputStream(data); - BufferedImage image = ImageIO.read(in); - return image; - } - - public static Image makeColorTransparent(BufferedImage im, final Color color) { - ImageFilter filter = new RGBImageFilter() { - - public int markerRGB = color.getRGB() | 0xFF000000; - - public final int filterRGB(int x, int y, int rgb) { - if ((rgb | 0xFF000000) == markerRGB) { - return 0x00FFFFFF & rgb; - } else { - return rgb; - } - } - }; - ImageProducer ip = new FilteredImageSource(im.getSource(), filter); - return Toolkit.getDefaultToolkit().createImage(ip); - } - - public static void writeFile(File f, byte[] data) { - try { - RandomAccessFile raf = new RandomAccessFile(f, "rw"); - try { - raf.write(data); - } finally { - raf.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - public static void writeFile(byte[] data, String fileName) throws IOException { - OutputStream out = new FileOutputStream(fileName); - out.write(data); - out.close(); - } - - public static byte[] fileToByteArray(int cacheIndex, int index) { - try { - if (SignLink.indexLocation(cacheIndex, index).length() <= 0 - || SignLink.indexLocation(cacheIndex, index) == null) { - return null; - } - File file = new File(SignLink.indexLocation(cacheIndex, index)); - byte[] fileData = new byte[(int) file.length()]; - FileInputStream fis = new FileInputStream(file); - fis.read(fileData); - fis.close(); - return fileData; - } catch (Exception e) { - return null; - } - } - - public static int readJAGHash(String string) { - int id = 0; - string = string.toUpperCase(); - for (int j = 0; j < string.length(); j++) { - id = (id * 61 + string.charAt(j)) - 32; - } - return id; - } - - public static int getCRCFromData(byte[] data) { - CRC32 crc = new CRC32(); - crc.update(data); - return (int) crc.getValue(); - } - - public static byte[] gZipDecompress(byte[] b) throws IOException { - GZIPInputStream gzi = new GZIPInputStream(new ByteArrayInputStream(b)); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - byte[] buf = new byte[1024]; - int len; - try { - while ((len = gzi.read(buf, 0, buf.length)) > 0) { - out.write(buf, 0, len); - } - } finally { - out.close(); - } - return out.toByteArray(); - } - - public static byte[] gzDecompress(byte[] b) throws IOException { - GZIPInputStream gzi = new GZIPInputStream(new ByteArrayInputStream(b)); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - byte[] buf = new byte[1024]; - int len; - while ((len = gzi.read(buf)) > 0) { - out.write(buf, 0, len); - } - out.close(); - return out.toByteArray(); - } - - public static byte[] unzip(byte[] data) throws IOException { - InputStream in = new ByteArrayInputStream(data); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try { - in = new GZIPInputStream(in); - byte[] buffer = new byte[65536]; - int noRead; - while ((noRead = in.read(buffer)) != -1) { - out.write(buffer, 0, noRead); - } - } finally { - try { - out.close(); - } catch (Exception e) { - } - } - return out.toByteArray(); - } - - public static byte[] readFile(String name) { - try { - RandomAccessFile raf = new RandomAccessFile(name, "r"); - ByteBuffer buf = - raf.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, raf.length()); - try { - if (buf.hasArray()) { - return buf.array(); - } else { - byte[] array = new byte[buf.remaining()]; - buf.get(array); - return array; - } - } finally { - raf.close(); - } - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static byte[] gZipCompress(byte[] data, int off, int len) throws IOException { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - GZIPOutputStream gzo = new GZIPOutputStream(bos); - try { - gzo.write(data, off, len); - } finally { - gzo.close(); - bos.close(); - } - return bos.toByteArray(); - } +public final class FileUtils { + + public static BufferedImage imageToBufferedImage(Image image) { + BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), + BufferedImage.TYPE_INT_ARGB); + Graphics2D g2 = bufferedImage.createGraphics(); + g2.drawImage(image, 0, 0, null); + g2.dispose(); + return bufferedImage; + } + + /** + * Converts an array of bytes to a {@link BufferedImage}. + * + * @param data + * The array of pixels. + * + * @return The newly created image. + */ + public static BufferedImage byteArrayToImage(byte[] data) throws IOException { + ByteArrayInputStream in = new ByteArrayInputStream(data); + BufferedImage image = ImageIO.read(in); + return image; + } + + public static Image makeColorTransparent(BufferedImage im, final Color color) { + ImageFilter filter = new RGBImageFilter() { + + public int markerRGB = color.getRGB() | 0xFF000000; + + @Override + public final int filterRGB(int x, int y, int rgb) { + if ((rgb | 0xFF000000) == markerRGB) { + return 0x00FFFFFF & rgb; + } else { + return rgb; + } + } + }; + ImageProducer ip = new FilteredImageSource(im.getSource(), filter); + return Toolkit.getDefaultToolkit().createImage(ip); + } + + public static void writeFile(File f, byte[] data) { + try { + RandomAccessFile raf = new RandomAccessFile(f, "rw"); + try { + raf.write(data); + } finally { + raf.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void writeFile(byte[] data, String fileName) throws IOException { + OutputStream out = new FileOutputStream(fileName); + out.write(data); + out.close(); + } + + public static byte[] fileToByteArray(int cacheIndex, int index) { + try { + if (SignLink.indexLocation(cacheIndex, index).length() <= 0 + || SignLink.indexLocation(cacheIndex, index) == null) { + return null; + } + File file = new File(SignLink.indexLocation(cacheIndex, index)); + byte[] fileData = new byte[(int) file.length()]; + FileInputStream fis = new FileInputStream(file); + fis.read(fileData); + fis.close(); + return fileData; + } catch (Exception e) { + return null; + } + } + + public static int readJAGHash(String string) { + int id = 0; + string = string.toUpperCase(); + for (int j = 0; j < string.length(); j++) { + id = (id * 61 + string.charAt(j)) - 32; + } + return id; + } + + public static int getCRCFromData(byte[] data) { + CRC32 crc = new CRC32(); + crc.update(data); + return (int) crc.getValue(); + } + + public static byte[] gZipDecompress(byte[] b) throws IOException { + GZIPInputStream gzi = new GZIPInputStream(new ByteArrayInputStream(b)); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] buf = new byte[1024]; + int len; + try { + while ((len = gzi.read(buf, 0, buf.length)) > 0) { + out.write(buf, 0, len); + } + } finally { + out.close(); + } + return out.toByteArray(); + } + + public static byte[] gzDecompress(byte[] b) throws IOException { + GZIPInputStream gzi = new GZIPInputStream(new ByteArrayInputStream(b)); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] buf = new byte[1024]; + int len; + while ((len = gzi.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.close(); + return out.toByteArray(); + } + + public static byte[] unzip(byte[] data) throws IOException { + InputStream in = new ByteArrayInputStream(data); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + in = new GZIPInputStream(in); + byte[] buffer = new byte[65536]; + int noRead; + while ((noRead = in.read(buffer)) != -1) { + out.write(buffer, 0, noRead); + } + } finally { + try { + out.close(); + } catch (Exception e) { + } + } + return out.toByteArray(); + } + + public static byte[] readFile(String name) { + try { + RandomAccessFile raf = new RandomAccessFile(name, "r"); + ByteBuffer buf = raf.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, raf.length()); + try { + if (buf.hasArray()) { + return buf.array(); + } else { + byte[] array = new byte[buf.remaining()]; + buf.get(array); + return array; + } + } finally { + raf.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static byte[] gZipCompress(byte[] data, int off, int len) throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + GZIPOutputStream gzo = new GZIPOutputStream(bos); + try { + gzo.write(data, off, len); + } finally { + gzo.close(); + bos.close(); + } + return bos.toByteArray(); + } } diff --git a/Elvarg - Server/data/saves/characters/Oak.json b/Elvarg - Server/data/saves/characters/Oak.json index e797fc6..13a5535 100644 --- a/Elvarg - Server/data/saves/characters/Oak.json +++ b/Elvarg - Server/data/saves/characters/Oak.json @@ -3,8 +3,8 @@ "password": "tja", "staff-rights": "ADMINISTRATOR", "position": { - "x": 3092, - "y": 3518, + "x": 1629, + "y": 3947, "z": 0 }, "spell-book": "NORMAL", @@ -15,41 +15,41 @@ "rigour": false, "augury": false, "has-veng": false, - "last-veng": 0, + "last-veng": -7512, "running": true, "run-energy": 100, "spec-percentage": 100, "recoil-damage": 0, "poison-damage": 0, - "poison-immunity": 0, - "overload-timer": 0, - "fire-immunity": 0, - "teleblock-timer": 0, - "prayerblock-timer": 0, - "skull-timer": -138767, + "poison-immunity": -6825, + "overload-timer": -6825, + "fire-immunity": -6825, + "teleblock-timer": -6825, + "prayerblock-timer": -6825, + "skull-timer": -11403, "target-kills": 0, "normal-kills": 0, - "deaths": 0, + "deaths": 3, "pkp": 0, "inventory": [ { - "id": 995, - "amount": 4653459, + "id": 4153, + "amount": 1, "slot": 0 }, { - "id": -1, - "amount": 0, + "id": 13226, + "amount": 1, "slot": 1 }, { - "id": -1, - "amount": 0, + "id": 2, + "amount": 2, "slot": 2 }, { - "id": -1, - "amount": 0, + "id": 11283, + "amount": 1, "slot": 3 }, { @@ -58,8 +58,8 @@ "slot": 4 }, { - "id": -1, - "amount": 0, + "id": 4675, + "amount": 1, "slot": 5 }, { @@ -78,68 +78,68 @@ "slot": 8 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 9 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 10 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 11 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 12 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 13 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 14 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 15 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 16 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 17 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 18 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 19 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 20 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 21 }, { @@ -148,13 +148,13 @@ "slot": 22 }, { - "id": -1, - "amount": 0, + "id": 385, + "amount": 1, "slot": 23 }, { - "id": -1, - "amount": 0, + "id": 249, + "amount": 1, "slot": 24 }, { @@ -175,34 +175,34 @@ ], "equipment": [ { - "id": -1, - "amount": 0, + "id": 1163, + "amount": 1, "slot": 0 }, { - "id": -1, - "amount": 0, - "slot": 0 + "id": 2414, + "amount": 1, + "slot": 1 }, { - "id": -1, - "amount": 0, - "slot": 0 + "id": 1712, + "amount": 1, + "slot": 2 }, { - "id": -1, - "amount": 0, + "id": 4587, + "amount": 1, "slot": 3 }, { - "id": -1, - "amount": 0, - "slot": 0 + "id": 1127, + "amount": 1, + "slot": 4 }, { - "id": -1, - "amount": 0, - "slot": 0 + "id": 12954, + "amount": 1, + "slot": 5 }, { "id": -1, @@ -210,9 +210,9 @@ "slot": 0 }, { - "id": -1, - "amount": 0, - "slot": 0 + "id": 1079, + "amount": 1, + "slot": 7 }, { "id": -1, @@ -220,14 +220,14 @@ "slot": 0 }, { - "id": -1, - "amount": 0, - "slot": 0 + "id": 7462, + "amount": 1, + "slot": 9 }, { - "id": -1, - "amount": 0, - "slot": 0 + "id": 3105, + "amount": 1, + "slot": 10 }, { "id": -1, @@ -267,7 +267,7 @@ 99, 99, 99, - 99, + 93, 99, 99, 99, @@ -312,13 +312,12 @@ 99 ], "experience": [ - 13034795, - 13034431, - 13034431, - 13034711, - 13034431, + 13038091, 13034431, + 13037181, + 13038733, 13034431, + 13034487, 13034431, 13034431, 13034431, @@ -328,6 +327,7 @@ 13034431, 13034431, 13034431, + 13034671, 13034431, 13034431, 13034431, @@ -382,7 +382,7 @@ }, { "id": 385, - "amount": 500, + "amount": 497, "slot": 8 }, { @@ -420,65 +420,45 @@ "amount": 100, "slot": 15 }, - { - "id": 1163, - "amount": 1, - "slot": 16 - }, - { - "id": 1127, - "amount": 1, - "slot": 17 - }, - { - "id": 1079, - "amount": 1, - "slot": 18 - }, - { - "id": 12954, - "amount": 1, - "slot": 19 - }, { "id": 4089, "amount": 1, - "slot": 20 + "slot": 16 }, { "id": 4091, "amount": 1, - "slot": 21 + "slot": 17 }, { "id": 4093, "amount": 1, - "slot": 22 + "slot": 18 }, { "id": 4095, "amount": 1, - "slot": 23 + "slot": 19 }, { "id": 4097, "amount": 1, - "slot": 24 + "slot": 20 }, { "id": 2503, "amount": 1, - "slot": 25 + "slot": 21 }, { "id": 2497, "amount": 1, - "slot": 26 + "slot": 22 }, { "id": 2491, "amount": 1, - "slot": 27 + "slot": 23 } ], "bank-1": [], diff --git a/Elvarg - Server/data/saves/characters/Oak2.json b/Elvarg - Server/data/saves/characters/Oak2.json new file mode 100644 index 0000000..b2ded41 --- /dev/null +++ b/Elvarg - Server/data/saves/characters/Oak2.json @@ -0,0 +1,352 @@ +{ + "username": "Oak2", + "password": "tja", + "staff-rights": "PLAYER", + "position": { + "x": 3091, + "y": 3505, + "z": 0 + }, + "spell-book": "NORMAL", + "auto-retaliate": true, + "xp-locked": false, + "clanchat": "", + "preserve": false, + "rigour": false, + "augury": false, + "has-veng": false, + "last-veng": -332, + "running": true, + "run-energy": 100, + "spec-percentage": 100, + "recoil-damage": 0, + "poison-damage": 0, + "poison-immunity": -332, + "overload-timer": -332, + "fire-immunity": -332, + "teleblock-timer": -332, + "prayerblock-timer": -332, + "skull-timer": -832, + "target-kills": 3, + "normal-kills": 0, + "deaths": 0, + "pkp": 0, + "inventory": [ + { + "id": 995, + "amount": 500000000, + "slot": 0 + }, + { + "id": 12748, + "amount": 1, + "slot": 1 + }, + { + "id": 11235, + "amount": 1, + "slot": 2 + }, + { + "id": 1215, + "amount": 1, + "slot": 3 + }, + { + "id": 4151, + "amount": 1, + "slot": 4 + }, + { + "id": 11212, + "amount": 990, + "slot": 5 + }, + { + "id": -1, + "amount": 0, + "slot": 6 + }, + { + "id": 4153, + "amount": 1, + "slot": 7 + }, + { + "id": 386, + "amount": 500, + "slot": 8 + }, + { + "id": 2441, + "amount": 100, + "slot": 9 + }, + { + "id": 2437, + "amount": 100, + "slot": 10 + }, + { + "id": 2443, + "amount": 100, + "slot": 11 + }, + { + "id": 2445, + "amount": 100, + "slot": 12 + }, + { + "id": 2435, + "amount": 100, + "slot": 13 + }, + { + "id": 3041, + "amount": 100, + "slot": 14 + }, + { + "id": 2431, + "amount": 100, + "slot": 15 + }, + { + "id": 1163, + "amount": 1, + "slot": 16 + }, + { + "id": 1127, + "amount": 1, + "slot": 17 + }, + { + "id": 1079, + "amount": 1, + "slot": 18 + }, + { + "id": 12954, + "amount": 1, + "slot": 19 + }, + { + "id": 4091, + "amount": 1, + "slot": 20 + }, + { + "id": -1, + "amount": 0, + "slot": 21 + }, + { + "id": 4095, + "amount": 1, + "slot": 22 + }, + { + "id": 4093, + "amount": 1, + "slot": 23 + }, + { + "id": -1, + "amount": 0, + "slot": 24 + }, + { + "id": -1, + "amount": 0, + "slot": 25 + }, + { + "id": -1, + "amount": 0, + "slot": 26 + }, + { + "id": -1, + "amount": 0, + "slot": 27 + } + ], + "equipment": [ + { + "id": 4089, + "amount": 1, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 9185, + "amount": 1, + "slot": 3 + }, + { + "id": 2503, + "amount": 1, + "slot": 4 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 2497, + "amount": 1, + "slot": 7 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 2491, + "amount": 1, + "slot": 9 + }, + { + "id": 4097, + "amount": 1, + "slot": 10 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 9244, + "amount": 4986, + "slot": 13 + } + ], + "appearance": [ + 0, + 3, + 18, + 26, + 34, + 38, + 42, + 14, + 2, + 14, + 5, + 4, + 0 + ], + "skills": { + "level": [ + 99, + 99, + 99, + 86, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99 + ], + "maxLevel": [ + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99, + 99 + ], + "experience": [ + 13034431, + 13034431, + 13034466, + 13034677, + 13034764, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431, + 13034431 + ] + }, + "friends": [], + "ignores": [], + "bank-0": [], + "bank-1": [], + "bank-2": [], + "bank-3": [], + "bank-4": [], + "bank-5": [], + "bank-6": [], + "bank-7": [], + "bank-8": [], + "bank-9": [] +} \ No newline at end of file diff --git a/Elvarg - Server/data/saves/characters/Oak23.json b/Elvarg - Server/data/saves/characters/Oak23.json new file mode 100644 index 0000000..fd0ff9e --- /dev/null +++ b/Elvarg - Server/data/saves/characters/Oak23.json @@ -0,0 +1,352 @@ +{ + "username": "Oak23", + "password": "tja", + "staff-rights": "PLAYER", + "position": { + "x": 3093, + "y": 3498, + "z": 0 + }, + "spell-book": "NORMAL", + "auto-retaliate": false, + "xp-locked": false, + "clanchat": "Elvarg", + "preserve": false, + "rigour": false, + "augury": false, + "has-veng": false, + "last-veng": 0, + "running": true, + "run-energy": 100, + "spec-percentage": 100, + "recoil-damage": 0, + "poison-damage": 0, + "poison-immunity": 0, + "overload-timer": 0, + "fire-immunity": 0, + "teleblock-timer": 0, + "prayerblock-timer": 0, + "skull-timer": -831, + "target-kills": 0, + "normal-kills": 0, + "deaths": 0, + "pkp": 0, + "inventory": [ + { + "id": 995, + "amount": 1000000000, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + } + ], + "equipment": [ + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + } + ], + "appearance": [ + 0, + 3, + 18, + 26, + 34, + 38, + 42, + 14, + 2, + 14, + 5, + 4, + 0 + ], + "skills": { + "level": [ + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "maxLevel": [ + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "experience": [ + 0, + 0, + 0, + 1184, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "friends": [], + "ignores": [], + "bank-0": [], + "bank-1": [], + "bank-2": [], + "bank-3": [], + "bank-4": [], + "bank-5": [], + "bank-6": [], + "bank-7": [], + "bank-8": [], + "bank-9": [] +} \ No newline at end of file diff --git a/Elvarg - Server/data/saves/characters/Oak45.json b/Elvarg - Server/data/saves/characters/Oak45.json new file mode 100644 index 0000000..4bbecab --- /dev/null +++ b/Elvarg - Server/data/saves/characters/Oak45.json @@ -0,0 +1,438 @@ +{ + "username": "Oak45", + "password": "tja", + "staff-rights": "PLAYER", + "position": { + "x": 3086, + "y": 3498, + "z": 0 + }, + "spell-book": "LUNAR", + "auto-retaliate": true, + "xp-locked": false, + "clanchat": "Elvarg", + "preserve": false, + "rigour": false, + "augury": false, + "has-veng": false, + "last-veng": -458, + "running": true, + "run-energy": 100, + "spec-percentage": 100, + "recoil-damage": 0, + "poison-damage": 0, + "poison-immunity": -458, + "overload-timer": -458, + "fire-immunity": -458, + "teleblock-timer": -458, + "prayerblock-timer": -458, + "skull-timer": -821, + "target-kills": 0, + "normal-kills": 0, + "deaths": 0, + "pkp": 0, + "inventory": [ + { + "id": 1007, + "amount": 1, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 1 + }, + { + "id": -1, + "amount": 0, + "slot": 2 + }, + { + "id": -1, + "amount": 0, + "slot": 3 + }, + { + "id": -1, + "amount": 0, + "slot": 4 + }, + { + "id": -1, + "amount": 0, + "slot": 5 + }, + { + "id": -1, + "amount": 0, + "slot": 6 + }, + { + "id": -1, + "amount": 0, + "slot": 7 + }, + { + "id": -1, + "amount": 0, + "slot": 8 + }, + { + "id": -1, + "amount": 0, + "slot": 9 + }, + { + "id": -1, + "amount": 0, + "slot": 10 + }, + { + "id": -1, + "amount": 0, + "slot": 11 + }, + { + "id": -1, + "amount": 0, + "slot": 12 + }, + { + "id": -1, + "amount": 0, + "slot": 13 + }, + { + "id": -1, + "amount": 0, + "slot": 14 + }, + { + "id": -1, + "amount": 0, + "slot": 15 + }, + { + "id": -1, + "amount": 0, + "slot": 16 + }, + { + "id": -1, + "amount": 0, + "slot": 17 + }, + { + "id": -1, + "amount": 0, + "slot": 18 + }, + { + "id": -1, + "amount": 0, + "slot": 19 + }, + { + "id": -1, + "amount": 0, + "slot": 20 + }, + { + "id": -1, + "amount": 0, + "slot": 21 + }, + { + "id": -1, + "amount": 0, + "slot": 22 + }, + { + "id": -1, + "amount": 0, + "slot": 23 + }, + { + "id": -1, + "amount": 0, + "slot": 24 + }, + { + "id": -1, + "amount": 0, + "slot": 25 + }, + { + "id": -1, + "amount": 0, + "slot": 26 + }, + { + "id": -1, + "amount": 0, + "slot": 27 + } + ], + "equipment": [ + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 1 + }, + { + "id": 1712, + "amount": 1, + "slot": 2 + }, + { + "id": 841, + "amount": 1, + "slot": 0 + }, + { + "id": 1129, + "amount": 1, + "slot": 4 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 1095, + "amount": 1, + "slot": 7 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 11118, + "amount": 1, + "slot": 9 + }, + { + "id": 1837, + "amount": 1, + "slot": 10 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 2552, + "amount": 1, + "slot": 12 + }, + { + "id": 882, + "amount": 250, + "slot": 13 + } + ], + "appearance": [ + 0, + 3, + 18, + 30, + 33, + 39, + 42, + 14, + 7, + 1, + 8, + 4, + 0 + ], + "skills": { + "level": [ + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "maxLevel": [ + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "experience": [ + 0, + 0, + 0, + 1184, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "friends": [], + "ignores": [], + "bank-0": [ + { + "id": 995, + "amount": 150000, + "slot": 0 + }, + { + "id": 8013, + "amount": 10, + "slot": 1 + }, + { + "id": 3842, + "amount": 1, + "slot": 2 + }, + { + "id": 3853, + "amount": 1, + "slot": 3 + }, + { + "id": 1067, + "amount": 1, + "slot": 4 + }, + { + "id": 1115, + "amount": 1, + "slot": 5 + }, + { + "id": 1323, + "amount": 1, + "slot": 6 + }, + { + "id": 1379, + "amount": 1, + "slot": 7 + }, + { + "id": 558, + "amount": 400, + "slot": 8 + }, + { + "id": 556, + "amount": 400, + "slot": 9 + }, + { + "id": 555, + "amount": 200, + "slot": 10 + }, + { + "id": 557, + "amount": 200, + "slot": 11 + }, + { + "id": 554, + "amount": 200, + "slot": 12 + }, + { + "id": 579, + "amount": 1, + "slot": 13 + }, + { + "id": 577, + "amount": 1, + "slot": 14 + }, + { + "id": 1011, + "amount": 1, + "slot": 15 + }, + { + "id": 379, + "amount": 48, + "slot": 16 + } + ], + "bank-1": [], + "bank-2": [], + "bank-3": [], + "bank-4": [], + "bank-5": [], + "bank-6": [], + "bank-7": [], + "bank-8": [], + "bank-9": [] +} \ No newline at end of file diff --git a/Elvarg - Server/data/saves/characters/Test.json b/Elvarg - Server/data/saves/characters/Test.json new file mode 100644 index 0000000..c9f81f7 --- /dev/null +++ b/Elvarg - Server/data/saves/characters/Test.json @@ -0,0 +1,352 @@ +{ + "username": "Test", + "password": "tja", + "staff-rights": "PLAYER", + "position": { + "x": 3091, + "y": 3500, + "z": 0 + }, + "spell-book": "NORMAL", + "auto-retaliate": false, + "xp-locked": false, + "clanchat": "Elvarg", + "preserve": false, + "rigour": false, + "augury": false, + "has-veng": false, + "last-veng": 0, + "running": true, + "run-energy": 100, + "spec-percentage": 100, + "recoil-damage": 0, + "poison-damage": 0, + "poison-immunity": 0, + "overload-timer": 0, + "fire-immunity": 0, + "teleblock-timer": 0, + "prayerblock-timer": 0, + "skull-timer": -15, + "target-kills": 0, + "normal-kills": 0, + "deaths": 0, + "pkp": 0, + "inventory": [ + { + "id": 995, + "amount": 150000, + "slot": 0 + }, + { + "id": 8013, + "amount": 10, + "slot": 1 + }, + { + "id": 2552, + "amount": 1, + "slot": 2 + }, + { + "id": 3853, + "amount": 1, + "slot": 3 + }, + { + "id": 1095, + "amount": 1, + "slot": 4 + }, + { + "id": 1129, + "amount": 1, + "slot": 5 + }, + { + "id": 882, + "amount": 250, + "slot": 6 + }, + { + "id": 841, + "amount": 1, + "slot": 7 + }, + { + "id": 1379, + "amount": 1, + "slot": 8 + }, + { + "id": 558, + "amount": 400, + "slot": 9 + }, + { + "id": 556, + "amount": 400, + "slot": 10 + }, + { + "id": 555, + "amount": 200, + "slot": 11 + }, + { + "id": 557, + "amount": 200, + "slot": 12 + }, + { + "id": 554, + "amount": 200, + "slot": 13 + }, + { + "id": 579, + "amount": 1, + "slot": 14 + }, + { + "id": 577, + "amount": 1, + "slot": 15 + }, + { + "id": 1011, + "amount": 1, + "slot": 16 + }, + { + "id": 380, + "amount": 44, + "slot": 17 + }, + { + "id": 379, + "amount": 1, + "slot": 18 + }, + { + "id": 379, + "amount": 1, + "slot": 19 + }, + { + "id": 379, + "amount": 1, + "slot": 20 + }, + { + "id": 379, + "amount": 1, + "slot": 21 + }, + { + "id": 379, + "amount": 1, + "slot": 22 + }, + { + "id": 379, + "amount": 1, + "slot": 23 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + } + ], + "equipment": [ + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 1007, + "amount": 1, + "slot": 1 + }, + { + "id": 1712, + "amount": 1, + "slot": 2 + }, + { + "id": 1323, + "amount": 1, + "slot": 3 + }, + { + "id": 1115, + "amount": 1, + "slot": 4 + }, + { + "id": 3842, + "amount": 1, + "slot": 5 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 1067, + "amount": 1, + "slot": 7 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": 11118, + "amount": 1, + "slot": 9 + }, + { + "id": 1837, + "amount": 1, + "slot": 10 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + } + ], + "appearance": [ + 0, + 3, + 18, + 26, + 34, + 38, + 42, + 14, + 2, + 14, + 5, + 4, + 0 + ], + "skills": { + "level": [ + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "maxLevel": [ + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "experience": [ + 0, + 0, + 0, + 1184, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "friends": [], + "ignores": [], + "bank-0": [], + "bank-1": [], + "bank-2": [], + "bank-3": [], + "bank-4": [], + "bank-5": [], + "bank-6": [], + "bank-7": [], + "bank-8": [], + "bank-9": [] +} \ No newline at end of file diff --git a/Elvarg - Server/data/saves/characters/Test3.json b/Elvarg - Server/data/saves/characters/Test3.json new file mode 100644 index 0000000..569a281 --- /dev/null +++ b/Elvarg - Server/data/saves/characters/Test3.json @@ -0,0 +1,352 @@ +{ + "username": "Test3", + "password": "tja", + "staff-rights": "PLAYER", + "position": { + "x": 3088, + "y": 3502, + "z": 0 + }, + "spell-book": "NORMAL", + "auto-retaliate": false, + "xp-locked": false, + "clanchat": "Elvarg", + "preserve": false, + "rigour": false, + "augury": false, + "has-veng": false, + "last-veng": -4, + "running": true, + "run-energy": 100, + "spec-percentage": 100, + "recoil-damage": 0, + "poison-damage": 0, + "poison-immunity": -4, + "overload-timer": -4, + "fire-immunity": -4, + "teleblock-timer": -4, + "prayerblock-timer": -4, + "skull-timer": -78, + "target-kills": 0, + "normal-kills": 0, + "deaths": 0, + "pkp": 0, + "inventory": [ + { + "id": 995, + "amount": 150000, + "slot": 0 + }, + { + "id": 8013, + "amount": 10, + "slot": 1 + }, + { + "id": 2552, + "amount": 1, + "slot": 2 + }, + { + "id": 3853, + "amount": 1, + "slot": 3 + }, + { + "id": 1095, + "amount": 1, + "slot": 4 + }, + { + "id": 1129, + "amount": 1, + "slot": 5 + }, + { + "id": 882, + "amount": 250, + "slot": 6 + }, + { + "id": 841, + "amount": 1, + "slot": 7 + }, + { + "id": 1379, + "amount": 1, + "slot": 8 + }, + { + "id": 558, + "amount": 400, + "slot": 9 + }, + { + "id": 556, + "amount": 400, + "slot": 10 + }, + { + "id": 555, + "amount": 200, + "slot": 11 + }, + { + "id": 557, + "amount": 200, + "slot": 12 + }, + { + "id": 554, + "amount": 200, + "slot": 13 + }, + { + "id": 579, + "amount": 1, + "slot": 14 + }, + { + "id": 577, + "amount": 1, + "slot": 15 + }, + { + "id": 1011, + "amount": 1, + "slot": 16 + }, + { + "id": 380, + "amount": 44, + "slot": 17 + }, + { + "id": 1323, + "amount": 1, + "slot": 18 + }, + { + "id": 1007, + "amount": 1, + "slot": 19 + }, + { + "id": 1712, + "amount": 1, + "slot": 20 + }, + { + "id": 379, + "amount": 1, + "slot": 21 + }, + { + "id": 379, + "amount": 1, + "slot": 22 + }, + { + "id": 379, + "amount": 1, + "slot": 23 + }, + { + "id": 1115, + "amount": 1, + "slot": 24 + }, + { + "id": 1067, + "amount": 1, + "slot": 25 + }, + { + "id": 11118, + "amount": 1, + "slot": 26 + }, + { + "id": 1837, + "amount": 1, + "slot": 27 + } + ], + "equipment": [ + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 1 + }, + { + "id": -1, + "amount": 0, + "slot": 2 + }, + { + "id": -1, + "amount": 0, + "slot": 3 + }, + { + "id": -1, + "amount": 0, + "slot": 4 + }, + { + "id": 3842, + "amount": 1, + "slot": 5 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 7 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 9 + }, + { + "id": -1, + "amount": 0, + "slot": 10 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + }, + { + "id": -1, + "amount": 0, + "slot": 0 + } + ], + "appearance": [ + 0, + 3, + 18, + 26, + 34, + 37, + 42, + 14, + 1, + 8, + 8, + 4, + 0 + ], + "skills": { + "level": [ + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "maxLevel": [ + 1, + 1, + 1, + 10, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "experience": [ + 0, + 0, + 0, + 1184, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "friends": [], + "ignores": [], + "bank-0": [], + "bank-1": [], + "bank-2": [], + "bank-3": [], + "bank-4": [], + "bank-5": [], + "bank-6": [], + "bank-7": [], + "bank-8": [], + "bank-9": [] +} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/GameConstants.java b/Elvarg - Server/src/com/elvarg/GameConstants.java index 3a6c827..a1dec3b 100644 --- a/Elvarg - Server/src/com/elvarg/GameConstants.java +++ b/Elvarg - Server/src/com/elvarg/GameConstants.java @@ -1,7 +1,9 @@ package com.elvarg; import com.elvarg.cache.impl.CacheConstants; +import com.elvarg.world.model.Item; import com.elvarg.world.model.Position; +import com.google.common.collect.ImmutableSet; /** * A class containing different attributes which affect the game in different @@ -56,13 +58,75 @@ public class GameConstants { * The tab interfaces in game. {Gameframe} [0] = tab Id, [1] = tab interface * Id */ - public static final int TAB_INTERFACES[][] = { { 0, 2423 }, { 1, 3917 }, { 2, 639 }, { 3, 3213 }, { 4, 1644 }, - { 5, 5608 }, { 6, -1 }, // Row 1 - - { 7, 37128 }, { 8, 5065 }, { 9, 5715 }, { 10, 2449 }, { 11, 42500 }, { 12, 147 } }; - public static final int[][] startKit = { { 995, 500000000 }, { 4151, 1 }, { 4153, 1 }, { 1215, 1 }, { 9185, 1 }, - { 11235, 1 }, { 9244, 5000 }, { 11212, 1000 }, { 386, 500 }, { 2441, 100 }, { 2437, 100 }, { 2443, 100 }, - { 2445, 100 }, { 2435, 100 }, { 3041, 100 }, { 2431, 100 }, { 1163, 1 }, { 1127, 1 }, { 1079, 1 }, - { 12954, 1 }, { 4089, 1 }, { 4091, 1 }, { 4093, 1 }, { 4095, 1 }, { 4097, 1 }, { 2503, 1 }, { 2497, 1 }, - { 2491, 1 } }; + public static final int TAB_INTERFACES[][] = { + + { 0, 2423 }, + + { 1, 3917 }, + + { 2, 639 }, + + { 3, 3213 }, + + { 4, 1644 }, + + { 5, 5608 }, + + { 6, -1 }, + + { 7, 37128 }, + + { 8, 5065 }, + + { 9, 5715 }, + + { 10, 2449 }, + + { 11, 42500 }, + + { 12, 147 } + + }; + + public static final ImmutableSet STATER_KIT_INVENTORY = ImmutableSet.of( + + new Item(995, 150000), + + new Item(8013, 10), + + new Item(2552, 1), + + new Item(3853, 1), + + new Item(1095, 1), + + new Item(1129, 1), + + new Item(882, 250), + + new Item(841, 1), + + new Item(1379, 1), + + new Item(558, 400), + + new Item(556, 400), + + new Item(555, 200), + + new Item(557, 200), + + new Item(554, 200), + + new Item(579, 1), + + new Item(577, 1), + + new Item(1011, 1), + + new Item(380, 44), + + new Item(379, 6) + + ); } diff --git a/Elvarg - Server/src/com/elvarg/cache/impl/definitions/ItemDefinition.java b/Elvarg - Server/src/com/elvarg/cache/impl/definitions/ItemDefinition.java index ad871bf..4afae5d 100644 --- a/Elvarg - Server/src/com/elvarg/cache/impl/definitions/ItemDefinition.java +++ b/Elvarg - Server/src/com/elvarg/cache/impl/definitions/ItemDefinition.java @@ -15,7 +15,6 @@ * * @author relex lawl */ - public class ItemDefinition { /** diff --git a/Elvarg - Server/src/com/elvarg/cache/impl/definitions/ObjectDefinition.java b/Elvarg - Server/src/com/elvarg/cache/impl/definitions/ObjectDefinition.java index db1d93c..fa3345b 100644 --- a/Elvarg - Server/src/com/elvarg/cache/impl/definitions/ObjectDefinition.java +++ b/Elvarg - Server/src/com/elvarg/cache/impl/definitions/ObjectDefinition.java @@ -23,23 +23,18 @@ public void load(JsonObject reader, Gson builder) { int x = reader.get("x").getAsInt(); int y = reader.get("y").getAsInt(); int z = 0; - if (reader.has("z")) { z = reader.get("z").getAsInt(); } - int face = reader.get("face").getAsInt(); - int type = 10; if (reader.has("type")) { type = reader.get("type").getAsInt(); } - int seconds = -1; if (reader.has("seconds")) { seconds = reader.get("seconds").getAsInt(); } - GameObject object = new GameObject(id, new Position(x, y, z), type, face, seconds); ObjectHandler.spawnGlobalObject(object); } @@ -111,7 +106,6 @@ public static ObjectDefinition forId(int id) { objectDef.type = id; objectDef.reset(); objectDef.readValues(stream); - // System.out.println("Object name: "+objectDef.name+", id: "+id); boolean removeObject = id == 5244 || id == 2623 || id == 2956 || id == 463 || id == 462 || id == 10527 || id == 10529 || id == 40257 || id == 296 || id == 300 || id == 1747 || id == 7332 || id == 7326 || id == 7325 || id == 7385 || id == 7331 || id == 7385 || id == 7320 || id == 7317 || id == 7323 @@ -124,30 +118,22 @@ public static ObjectDefinition forId(int id) { || id == 25891 || id == 26082 || id == 26081 || id == 1530 || id == 16776 || id == 16778 || id == 28589 || id == 1533 || id == 17089 || id == 1600 || id == 1601 || id == 11707 || id == 24376 || id == 24378 || id == 40108 || id == 59 || id == 2069 || id == 36846; - if (objectDef.name != null) { - if (objectDef.name.toLowerCase().contains(("door")) || objectDef.name.toLowerCase().contains(("gate"))) { - removeObject = true; - } - } if (removeObject) { objectDef.modelIds = null; objectDef.isInteractive = false; objectDef.solid = false; return objectDef; } - if (id == 6552) { objectDef.interactions = new String[5]; objectDef.interactions[0] = "Toggle-spells"; objectDef.name = "Ancient altar"; } - if (id == 14911) { objectDef.interactions = new String[5]; objectDef.interactions[0] = "Toggle-spells"; objectDef.name = "Lunar altar"; } - if (id == 7149 || id == 7147) { objectDef.isInteractive = true; objectDef.interactions = new String[5]; @@ -208,7 +194,6 @@ public static ObjectDefinition forId(int id) { objectDef.isInteractive = true; return objectDef; } - return objectDef; } @@ -251,14 +236,32 @@ public void reset() { childrenIDs = null; } - public static void init() { - // long startup = System.currentTimeMillis(); - // System.out.println("Loading cache game object definitions..."); + /** + * Returns true if the door object is open. + * + * @param id + * the id of the door object. + * @return is the door open. + */ + public static final boolean isDoorOpen(int id) { + ObjectDefinition def = ObjectDefinition.forId(id); + if (def.interactions != null) { + for (String i : def.interactions) { + if (i == null) { + continue; + } + if (i.equals("Close")) { + return true; + } + } + } + return false; + } + public static void init() { CacheArchive objectDefs = Elvarg.getCache().getArchive(CacheConstants.CONFIG_ARCHIVE); stream = new ByteStreamExt(objectDefs.getData("loc.dat").array()); ByteStreamExt idxBuffer525 = new ByteStreamExt(objectDefs.getData("loc.idx").array()); - int totalObjects525 = idxBuffer525.readUnsignedWord(); streamIndices = new int[totalObjects525]; int i = 2; @@ -266,16 +269,10 @@ public static void init() { streamIndices[j] = i; i += idxBuffer525.readUnsignedWord(); } - cache = new ObjectDefinition[20]; for (int k = 0; k < 20; k++) { cache[k] = new ObjectDefinition(); } - - // System.out.println("Loaded " + totalObjects525 + " cache object - // definitions #525 "); - // + totalObjects667 + " cache object definitions #667 in " + - // (System.currentTimeMillis() - startup) + "ms"); } public void readValues(ByteStreamExt buffer) { diff --git a/Elvarg - Server/src/com/elvarg/net/packet/PacketBuilder.java b/Elvarg - Server/src/com/elvarg/net/packet/PacketBuilder.java index 8e179dd..27f100e 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/PacketBuilder.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/PacketBuilder.java @@ -245,6 +245,7 @@ public PacketBuilder put(int value) { * @throws IllegalArgumentExcpetion * if middle or inverse-middle value types are selected. */ + @SuppressWarnings("incomplete-switch") public PacketBuilder putShort(int value, ValueType type, ByteOrder order) { switch (order) { case BIG: diff --git a/Elvarg - Server/src/com/elvarg/net/packet/PacketConstants.java b/Elvarg - Server/src/com/elvarg/net/packet/PacketConstants.java index b269e75..f1174a4 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/PacketConstants.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/PacketConstants.java @@ -91,6 +91,7 @@ public class PacketConstants { public static final int SECOND_ITEM_ACTION_OPCODE = 75; public static final int THIRD_ITEM_ACTION_OPCODE = 16; public static final int ITEM_ON_ITEM = 53; + public static final int ITEM_ON_OBJECT = 192; static { for (int i = 0; i < PACKETS.length; i++) { @@ -137,6 +138,7 @@ public class PacketConstants { PACKETS[OBJECT_THIRD_CLICK_OPCODE] = new ObjectActionPacketListener(); PACKETS[OBJECT_FOURTH_CLICK_OPCODE] = new ObjectActionPacketListener(); PACKETS[OBJECT_FIFTH_CLICK_OPCODE] = new ObjectActionPacketListener(); + PACKETS[ITEM_ON_OBJECT] = new ObjectActionPacketListener(); PACKETS[ATTACK_NPC_OPCODE] = new NPCOptionPacketListener(); PACKETS[FIRST_CLICK_OPCODE] = new NPCOptionPacketListener(); diff --git a/Elvarg - Server/src/com/elvarg/net/packet/PacketSender.java b/Elvarg - Server/src/com/elvarg/net/packet/PacketSender.java index b0b2dd7..6934fb5 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/PacketSender.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/PacketSender.java @@ -7,7 +7,6 @@ import com.elvarg.world.entity.impl.object.GameObject; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Animation; -import com.elvarg.world.model.EffectTimer; import com.elvarg.world.model.Graphic; import com.elvarg.world.model.Item; import com.elvarg.world.model.PlayerInteractingOption; @@ -218,13 +217,6 @@ public PacketSender sendRunEnergy(int energy) { return this; } - public PacketSender updateSpecialAttackOrb() { - PacketBuilder out = new PacketBuilder(137); - out.put(player.getSpecialPercentage()); - player.getSession().write(out); - return this; - } - public PacketSender sendDungeoneeringTabIcon(boolean show) { PacketBuilder out = new PacketBuilder(103); out.put(show ? 1 : 0); @@ -519,17 +511,6 @@ public PacketSender sendCurrentBankTab(int current_tab) { return this; } - public PacketSender sendEffectTimer(int delay, EffectTimer e) { - - PacketBuilder out = new PacketBuilder(54); - - out.putShort(delay); - out.putShort(e.getClientSprite()); - - player.getSession().write(out); - return this; - } - public PacketSender sendInterfaceItems(int interfaceId, List items) { PacketBuilder out = new PacketBuilder(53); out.putInt(interfaceId); diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/ButtonClickPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/ButtonClickPacketListener.java index 822022a..26edf49 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/ButtonClickPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/ButtonClickPacketListener.java @@ -7,9 +7,9 @@ import com.elvarg.util.Misc; import com.elvarg.world.content.Emotes; import com.elvarg.world.content.ItemsKeptOnDeath; -import com.elvarg.world.content.PrayerHandler; import com.elvarg.world.content.TeleportsInterface; import com.elvarg.world.content.clan.ClanChatManager; +import com.elvarg.world.content.skills.prayer.PrayerHandler; import com.elvarg.world.entity.combat.magic.Autocasting; import com.elvarg.world.entity.combat.magic.MagicClickSpells; import com.elvarg.world.entity.impl.player.Player; diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/DropItemPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/DropItemPacketListener.java index 14297bd..e48e50e 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/DropItemPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/DropItemPacketListener.java @@ -22,55 +22,44 @@ public void handleMessage(Player player, Packet packet) { int id = packet.readUnsignedShortA(); int interface_id = packet.readUnsignedShort(); int itemSlot = packet.readUnsignedShortA(); - if (interface_id != Inventory.INTERFACE_ID) { return; } - - if (player.getHitpoints() <= 0 || player.getInterfaceId() > 0) + if (player.getHitpoints() <= 0 || player.getInterfaceId() > 0) { return; - if (itemSlot < 0 || itemSlot > player.getInventory().capacity()) + } + if (itemSlot < 0 || itemSlot > player.getInventory().capacity()) { return; - + } if (player.busy()) { - player.getPacketSender().sendMessage("You cannot do this right now."); + player.getPacketSender().sendMessage("You can't do this right now."); return; } - - Item item = player.getInventory().getItems()[itemSlot]; - if (item == null) - return; - if (item.getId() != id || item.getAmount() <= 0) { + final Item interacted = player.getInventory().forSlot(itemSlot); + if (interacted == null || interacted.getId() != id || interacted.getSlot() != itemSlot) { return; } player.getPacketSender().sendInterfaceRemoval(); - - if (item.getDefinition().isDropable()) { - + if (interacted.getDefinition().isDropable()) { player.getInventory().setItem(itemSlot, new Item(-1, 0)).refreshItems(); GroundItemManager.spawnGroundItem(player, - new GroundItem(item, player.getPosition().copy(), player.getUsername(), player.getHostAddress(), - false, 80, + new GroundItem(interacted, player.getPosition().copy(), player.getUsername(), + player.getHostAddress(), false, 80, player.getPosition().getZ() >= 0 && player.getPosition().getZ() < 4 ? true : false, 80)); - } else { - destroyItemInterface(player, item); + destroyItemInterface(player, interacted); } } - public static void destroyItemInterface(Player player, Item item) {// Destroy - // item - // created - // by - // Remco + public static void destroyItemInterface(Player player, Item item) { player.setDestroyItem(item.getId()); - String[][] info = { // The info the dialogue gives - { "Are you sure you want to discard this item?", "14174" }, { "Yes.", "14175" }, { "No.", "14176" }, - { "", "14177" }, { "This item will vanish once it hits the floor.", "14182" }, + String[][] info = { { "Are you sure you want to discard this item?", "14174" }, { "Yes.", "14175" }, + { "No.", "14176" }, { "", "14177" }, { "This item will vanish once it hits the floor.", "14182" }, { "You cannot get it back if discarded.", "14183" }, { item.getDefinition().getName(), "14184" } }; player.getPacketSender().sendItemOnInterface(14171, item.getId(), 0, item.getAmount()); - for (int i = 0; i < info.length; i++) + for (int i = 0; i < info.length; i++) { player.getPacketSender().sendString(Integer.parseInt(info[i][1]), info[i][0]); + } player.getPacketSender().sendChatboxInterface(14170); } } diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/EquipPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/EquipPacketListener.java index 1b6243d..c71c6b0 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/EquipPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/EquipPacketListener.java @@ -27,34 +27,27 @@ public class EquipPacketListener implements PacketListener { @Override public void handleMessage(Player player, Packet packet) { - if (player.getHitpoints() <= 0) + if (player.getHitpoints() <= 0) { return; - + } int id = packet.readShort(); int slot = packet.readShortA(); int interfaceId = packet.readShortA(); - if (player.getInterfaceId() != Equipment.EQUIPMENT_SCREEN_INTERFACE_ID) { player.getPacketSender().sendInterfaceRemoval(); } - switch (interfaceId) { case Inventory.INTERFACE_ID: - /* - * Making sure slot is valid. - */ if (slot >= 0 && slot <= 28) { Item item = player.getInventory().getItems()[slot].copy(); if (item.getId() != id) { return; } - /* - * Making sure item exists and that id is consistent. - */ if (item != null && id == item.getId()) { for (Skill skill : Skill.values()) { - if (skill == Skill.CONSTRUCTION) + if (skill == Skill.CONSTRUCTION) { continue; + } if (item.getDefinition().getRequirement()[skill.ordinal()] > player.getSkillManager() .getMaxLevel(skill)) { StringBuilder vowel = new StringBuilder(); @@ -67,7 +60,7 @@ public void handleMessage(Player player, Packet packet) { } player.getPacketSender().sendMessage("You need " + vowel.toString() + Misc.formatText(skill.getName()) + " level of at least " - + item.getDefinition().getRequirement()[skill.ordinal()] + " to wear this."); + + item.getDefinition().getRequirement()[skill.ordinal()] + " to equip this."); return; } } @@ -153,13 +146,7 @@ public void handleMessage(Player player, Packet packet) { } if (equipmentSlot == Equipment.WEAPON_SLOT) { resetWeapon(player); - } else if (equipmentSlot == Equipment.RING_SLOT && item.getId() == 2570) { - player.getPacketSender() - .sendMessage( - " Warning! The Ring of Life special effect does not work in the Wilderness or") - .sendMessage(" Duel Arena."); } - // Check if ranged update is needed! if (equipmentSlot == Equipment.AMMUNITION_SLOT || equipmentSlot == Equipment.WEAPON_SLOT) { RangedData.updateDataFor(player); @@ -169,7 +156,6 @@ public void handleMessage(Player player, Packet packet) { player.getCombat().reset(); } - // player.setCastSpell(null); BonusManager.update(player); player.getEquipment().refreshItems(); @@ -181,15 +167,13 @@ public void handleMessage(Player player, Packet packet) { } player.getUpdateFlag().flag(Flag.APPEARANCE); - // Sounds.sendSound(player, Sound.EQUIP_ITEM); - } } break; } } - public static void resetWeapon(Player player) { + public void resetWeapon(Player player) { WeaponInterfaces.assign(player); player.setSpecialActivated(false); CombatSpecial.updateBar(player); diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/ExamineItemPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/ExamineItemPacketListener.java index 3dc5d82..42d37e7 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/ExamineItemPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/ExamineItemPacketListener.java @@ -10,12 +10,10 @@ public class ExamineItemPacketListener implements PacketListener { @Override public void handleMessage(Player player, Packet packet) { int item = packet.readShort(); - if (item == 995) { player.getPacketSender().sendMessage(player.getInventory().getAmount(995) + "x coins."); return; } - ItemDefinition itemDef = ItemDefinition.forId(item); if (itemDef != null) { player.getPacketSender().sendMessage(itemDef.getExamine()); diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/ExamineNpcPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/ExamineNpcPacketListener.java index 7ec469f..50216b7 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/ExamineNpcPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/ExamineNpcPacketListener.java @@ -13,7 +13,6 @@ public void handleMessage(Player player, Packet packet) { if (npc <= 0) { return; } - System.out.println("NPC: " + npc); NpcDefinition npcDef = NpcDefinition.forId(npc); if (npcDef != null) { player.getPacketSender().sendMessage(npcDef.getExamine()); diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/FollowPlayerPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/FollowPlayerPacketListener.java index 2d386da..a163e21 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/FollowPlayerPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/FollowPlayerPacketListener.java @@ -15,19 +15,18 @@ public class FollowPlayerPacketListener implements PacketListener { @Override public void handleMessage(Player player, Packet packet) { - if (player.getHitpoints() <= 0) + if (player.getHitpoints() <= 0) { return; + } int otherPlayersIndex = packet.readLEShort(); - if (otherPlayersIndex < 0 || otherPlayersIndex > World.getPlayers().capacity()) + if (otherPlayersIndex < 0 || otherPlayersIndex > World.getPlayers().capacity()) { return; + } Player leader = World.getPlayers().get(otherPlayersIndex); - if (leader == null) + if (leader == null) { return; - if (leader.getHitpoints() <= 0 - || player.getHitpoints() <= 0/* - * || !player.getLocation(). - * isFollowingAllowed() - */) { + } + if (leader.getHitpoints() <= 0 || player.getHitpoints() <= 0) { player.getPacketSender().sendMessage("You cannot follow other players right now."); return; } diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/ItemActionPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/ItemActionPacketListener.java index e78dae8..6f21508 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/ItemActionPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/ItemActionPacketListener.java @@ -12,9 +12,10 @@ import com.elvarg.world.content.skills.herblore.FinishedPotionData; import com.elvarg.world.content.skills.herblore.HerbIdentification; import com.elvarg.world.content.skills.herblore.UnfinishedPotionData; +import com.elvarg.world.content.skills.prayer.BoneBurying; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Item; -import com.elvarg.world.model.teleportation.tabs.TabHandler; +import com.elvarg.world.model.teleportation.tabs.TeleportTablet; @SuppressWarnings("unused") public class ItemActionPacketListener implements PacketListener { @@ -33,22 +34,25 @@ private void onItemAction(final Player player, Packet packet) { if (ItemDefinition.forId(first.getId()).getName().contains("(unf)")) { final Optional data = FinishedPotionData.get(first); if (data.isPresent()) { - CreateFinishedPotionTask task = new CreateFinishedPotionTask(player, data, 28); - task.start(player); + if (second.getId() == data.get().getIngredient().getId()) { + CreateFinishedPotionTask task = new CreateFinishedPotionTask(player, data, 28); + task.start(player); + } } return; } - if (first.getId() == CreateUnfinishedPotionTask.VIAL_OF_WATER - && ItemDefinition.forId(second.getId()).getName().contains("weed") - || ItemDefinition.forId(second.getId()).getName().contains("leaf")) { - final Optional data = UnfinishedPotionData.get(second); - if (data.isPresent()) { - CreateUnfinishedPotionTask task = new CreateUnfinishedPotionTask(player, data, 28); - task.start(player); + if (first.getId() == CreateUnfinishedPotionTask.VIAL_OF_WATER) { + if (ItemDefinition.forId(second.getId()).getName().contains("weed") + || ItemDefinition.forId(second.getId()).getName().contains("leaf")) { + final Optional data = UnfinishedPotionData.get(second); + if (data.isPresent()) { + CreateUnfinishedPotionTask task = new CreateUnfinishedPotionTask(player, data, 28); + task.start(player); + } + return; } - return; } - player.getPacketSender().sendMessage("Nothing interesting happens.."); + player.getPacketSender().sendMessage("Nothing interesting happens..."); } private void firstAction(final Player player, Packet packet) { @@ -56,19 +60,32 @@ private void firstAction(final Player player, Packet packet) { int itemId = packet.readShort(); int slot = packet.readShort(); final Item interacted = player.getInventory().forSlot(slot); - if (interacted == null || interacted.getId() != itemId || interacted.getSlot() != slot) { + if (interacted == null || itemId != interacted.getId() || slot != interacted.getSlot() + || !player.getInventory().contains(interacted.getId())) { return; } if (Consumables.isFood(player, interacted)) { return; } - if (ItemDefinition.forId(interacted.getId()).getName().contains("Grimy")) { + if (ItemDefinition.forId(interacted.getId()).getName().toLowerCase().contains("bone")) { + BoneBurying.bury(player, BoneBurying.forId(interacted.getId()), interacted); + return; + } + if (ItemDefinition.forId(interacted.getId()).getName().toLowerCase().contains("grimy")) { HerbIdentification.cleanHerb(player, interacted); return; } - TabHandler.onClick(player, interacted); + if (ItemDefinition.forId(interacted.getId()).getName().toLowerCase().contains("teleport")) { + TeleportTablet.onClick(player, interacted); + return; + } switch (interacted.getId()) { - + case 13226: + player.herbSack().fillSack(); + break; + default: + player.getPacketSender().sendMessage("Nothing interesting happens..."); + break; } } @@ -77,11 +94,14 @@ private void secondAction(final Player player, Packet packet) { int slot = packet.readLEShort(); int itemId = packet.readShortA(); final Item interacted = player.getInventory().forSlot(slot); - if (interacted == null || interacted.getId() != itemId || interacted.getSlot() != slot) { + if (interacted == null || itemId != interacted.getId() || slot != interacted.getSlot() + || !player.getInventory().contains(interacted.getId())) { return; } switch (interacted.getId()) { - + case 13226: + player.herbSack().checkSack(); + break; } } @@ -90,11 +110,14 @@ private void thirdClickAction(final Player player, Packet packet) { int slot = packet.readLEShortA(); int interfaceId = packet.readLEShortA(); final Item interacted = player.getInventory().forSlot(slot); - if (interacted == null || interacted.getId() != itemId || interacted.getSlot() != slot) { + if (interacted == null || itemId != interacted.getId() || slot != interacted.getSlot() + || !player.getInventory().contains(interacted.getId())) { return; } switch (interacted.getId()) { - + case 13226: + player.herbSack().emptySack(); + break; } } diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/ItemContainerActionPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/ItemContainerActionPacketListener.java index e693047..2dc89b5 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/ItemContainerActionPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/ItemContainerActionPacketListener.java @@ -50,17 +50,15 @@ public void handleMessage(Player player, Packet packet) { } } - private static void firstAction(Player player, Packet packet) { + private void firstAction(Player player, Packet packet) { int interfaceId = packet.readInt(); int slot = packet.readShortA(); int id = packet.readShortA(); - // Bank withdrawal.. if (interfaceId >= Bank.CONTAINER_START && interfaceId < Bank.CONTAINER_START + Bank.TOTAL_BANK_TABS) { Bank.withdraw(player, id, slot, 1, interfaceId - Bank.CONTAINER_START); return; } - switch (interfaceId) { case Trading.INVENTORY_CONTAINER_INTERFACE: // Duel/Trade inventory @@ -90,35 +88,23 @@ private static void firstAction(Player player, Packet packet) { case Equipment.INVENTORY_INTERFACE_ID: // Unequip Item item = player.getEquipment().getItems()[slot]; - if (item == null || item.getId() != id) + if (item == null || item.getId() != id) { return; - /* - * if(player.getLocation() == Location.DUEL_ARENA) { - * if(player.getDueling().selectedDuelRules[DuelRule.LOCK_WEAPON. - * ordinal()]) { if(item.getDefinition().getEquipmentSlot() == - * Equipment.WEAPON_SLOT || item.getDefinition().isTwoHanded()) { - * player.getPacketSender(). - * sendMessage("Weapons have been locked during this duel!"); - * return; } } } - */ + } boolean stackItem = item.getDefinition().isStackable() && player.getInventory().getAmount(item.getId()) > 0; int inventorySlot = player.getInventory().getEmptySlot(); if (inventorySlot != -1) { - player.getEquipment().setItem(slot, new Item(-1, 0)); - if (stackItem) { player.getInventory().add(item.getId(), item.getAmount()); } else { player.getInventory().setItem(inventorySlot, item); } - // Check if ranged update is needed! if (item.getDefinition().getEquipmentSlot() == Equipment.AMMUNITION_SLOT || item.getDefinition().getEquipmentSlot() == Equipment.WEAPON_SLOT) { RangedData.updateDataFor(player); } - BonusManager.update(player); if (item.getDefinition().getEquipmentSlot() == Equipment.WEAPON_SLOT) { WeaponInterfaces.assign(player); @@ -139,17 +125,15 @@ private static void firstAction(Player player, Packet packet) { } } - private static void secondAction(Player player, Packet packet) { + private void secondAction(Player player, Packet packet) { int interfaceId = packet.readInt(); int id = packet.readLEShortA(); int slot = packet.readLEShort(); - // Bank withdrawal.. if (interfaceId >= Bank.CONTAINER_START && interfaceId < Bank.CONTAINER_START + Bank.TOTAL_BANK_TABS) { Bank.withdraw(player, id, slot, 5, interfaceId - Bank.CONTAINER_START); return; } - switch (interfaceId) { case Shop.ITEM_CHILD_ID: Shop.buyItem(player, interfaceId, id, slot, 1); @@ -178,17 +162,15 @@ private static void secondAction(Player player, Packet packet) { } } - private static void thirdAction(Player player, Packet packet) { + private void thirdAction(Player player, Packet packet) { int interfaceId = packet.readInt(); int id = packet.readShortA(); int slot = packet.readShortA(); - // Bank withdrawal.. if (interfaceId >= Bank.CONTAINER_START && interfaceId < Bank.CONTAINER_START + Bank.TOTAL_BANK_TABS) { Bank.withdraw(player, id, slot, 10, interfaceId - Bank.CONTAINER_START); return; } - switch (interfaceId) { case Shop.ITEM_CHILD_ID: Shop.buyItem(player, interfaceId, id, slot, 5); @@ -217,17 +199,15 @@ private static void thirdAction(Player player, Packet packet) { } } - private static void fourthAction(Player player, Packet packet) { + private void fourthAction(Player player, Packet packet) { int slot = packet.readShortA(); int interfaceId = packet.readInt(); int id = packet.readShortA(); - // Bank withdrawal.. if (interfaceId >= Bank.CONTAINER_START && interfaceId < Bank.CONTAINER_START + Bank.TOTAL_BANK_TABS) { Bank.withdraw(player, id, slot, -1, interfaceId - Bank.CONTAINER_START); return; } - switch (interfaceId) { case Shop.ITEM_CHILD_ID: Shop.buyItem(player, interfaceId, id, slot, 10); @@ -258,23 +238,22 @@ private static void fourthAction(Player player, Packet packet) { } } - private static void fifthAction(Player player, Packet packet) { + private void fifthAction(Player player, Packet packet) { int interfaceId = packet.readInt(); int slot = packet.readLEShort(); int id = packet.readLEShort(); - // Bank withdrawal.. if (interfaceId >= Bank.CONTAINER_START && interfaceId < Bank.CONTAINER_START + Bank.TOTAL_BANK_TABS) { player.setEnterSyntax(new WithdrawBankX(id, slot, interfaceId - Bank.CONTAINER_START)); player.getPacketSender().sendEnterAmountPrompt("How many would you like to withdraw?"); return; } - switch (interfaceId) { case Shop.INVENTORY_INTERFACE_ID: player.setEnterSyntax(new SellX(id, interfaceId, slot)); player.getPacketSender().sendEnterAmountPrompt("How many would you like to sell?"); break; + case Shop.ITEM_CHILD_ID: player.setEnterSyntax(new BuyX(id, interfaceId, slot)); player.getPacketSender().sendEnterAmountPrompt("How many would you like to buy?"); @@ -284,6 +263,7 @@ private static void fifthAction(Player player, Packet packet) { player.setEnterSyntax(new BankX(id, slot)); player.getPacketSender().sendEnterAmountPrompt("How many would you like to bank?"); break; + case Trading.INVENTORY_CONTAINER_INTERFACE: // Duel/Trade inventory if (player.getStatus() == PlayerStatus.PRICE_CHECKING) { player.setEnterSyntax(new PriceCheckX(id, slot, true)); @@ -293,12 +273,14 @@ private static void fifthAction(Player player, Packet packet) { player.getPacketSender().sendEnterAmountPrompt("How many would you like to offer?"); } break; + case Trading.CONTAINER_INTERFACE_ID: if (player.getStatus() == PlayerStatus.TRADING) { player.setEnterSyntax(new TradeX(id, slot, false)); player.getPacketSender().sendEnterAmountPrompt("How many would you like to remove?"); } break; + case PriceChecker.CONTAINER_ID: player.setEnterSyntax(new PriceCheckX(id, slot, false)); player.getPacketSender().sendEnterAmountPrompt("How many would you like to withdraw?"); @@ -306,6 +288,6 @@ private static void fifthAction(Player player, Packet packet) { } } - private static void sixthAction(Player player, Packet packet) { + private void sixthAction(Player player, Packet packet) { } } diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/NPCOptionPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/NPCOptionPacketListener.java index ced86d1..fee65c9 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/NPCOptionPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/NPCOptionPacketListener.java @@ -12,7 +12,6 @@ import com.elvarg.world.entity.impl.npc.NPC; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Flag; -import com.elvarg.world.model.PlayerRights; import com.elvarg.world.model.Skill; import com.elvarg.world.model.container.impl.Shop; import com.elvarg.world.model.dialogue.DialogueManager; @@ -22,14 +21,14 @@ public class NPCOptionPacketListener implements PacketListener { private static void firstClick(Player player, Packet packet) { int index = packet.readLEShort(); - if (index < 0 || index > World.getNpcs().capacity()) + if (index < 0 || index > World.getNpcs().capacity()) { return; + } final NPC npc = World.getNpcs().get(index); - if (npc == null) + if (npc == null) { return; + } player.setEntityInteraction(npc); - if (player.getRights() == PlayerRights.ADMINISTRATOR) - player.getPacketSender().sendMessage("First click npc id: " + npc.getId()); player.setWalkToTask(new WalkToTask(player, npc.getPosition(), npc.getSize(), new FinalizedMovementTask() { @Override public void execute() { @@ -142,7 +141,7 @@ public void handleOption3(Player player) { DialogueManager.start(player, 3); } else { DialogueManager.start(player, 2); - player.getPacketSender().sendMessage("@red@You have been skulled!"); + player.getPacketSender().sendMessage("You have been skulled."); player.setSkullTimer(600); // 6 minutes exactly. player.getUpdateFlag().flag(Flag.APPEARANCE); } @@ -168,15 +167,14 @@ public void handleOption4(Player player) { public void handleSecondClick(Player player, Packet packet) { int index = packet.readLEShortA(); - if (index < 0 || index > World.getNpcs().capacity()) + if (index < 0 || index > World.getNpcs().capacity()) { return; + } final NPC npc = World.getNpcs().get(index); - if (npc == null) + if (npc == null) { return; + } player.setEntityInteraction(npc); - final int npcId = npc.getId(); - if (player.getRights() == PlayerRights.DEVELOPER) - player.getPacketSender().sendMessage("Second click npc id: " + npcId); player.setWalkToTask(new WalkToTask(player, npc.getPosition(), npc.getSize(), new FinalizedMovementTask() { @Override public void execute() { @@ -214,15 +212,14 @@ public void execute() { public void handleThirdClick(Player player, Packet packet) { int index = packet.readShort(); - if (index < 0 || index > World.getNpcs().capacity()) + if (index < 0 || index > World.getNpcs().capacity()) { return; + } final NPC npc = World.getNpcs().get(index); - if (npc == null) + if (npc == null) { return; + } player.setEntityInteraction(npc).setPositionToFace(npc.getPosition().copy()); - npc.setPositionToFace(player.getPosition()); - if (player.getRights() == PlayerRights.DEVELOPER) - player.getPacketSender().sendMessage("Third click npc id: " + npc.getId()); player.setWalkToTask(new WalkToTask(player, npc.getPosition(), npc.getSize(), new FinalizedMovementTask() { @Override public void execute() { @@ -257,14 +254,14 @@ public void execute() { public void handleFourthClick(Player player, Packet packet) { int index = packet.readLEShort(); - if (index < 0 || index > World.getNpcs().capacity()) + if (index < 0 || index > World.getNpcs().capacity()) { return; + } final NPC npc = World.getNpcs().get(index); - if (npc == null) + if (npc == null) { return; + } player.setEntityInteraction(npc); - if (player.getRights() == PlayerRights.DEVELOPER) - player.getPacketSender().sendMessage("Fourth click npc id: " + npc.getId()); player.setWalkToTask(new WalkToTask(player, npc.getPosition(), npc.getSize(), new FinalizedMovementTask() { @Override public void execute() { @@ -274,7 +271,7 @@ public void execute() { DialogueManager.start(player, 3); } else { DialogueManager.start(player, 2); - player.getPacketSender().sendMessage("@red@You have been skulled!"); + player.getPacketSender().sendMessage("You have been skulled."); player.setSkullTimer(600); // 6 minutes exactly. player.getUpdateFlag().flag(Flag.APPEARANCE); } @@ -288,59 +285,47 @@ public void execute() { private static void attackNPC(Player player, Packet packet) { int index = packet.readShortA(); - if (index < 0 || index > World.getNpcs().capacity()) + if (index < 0 || index > World.getNpcs().capacity()) { return; + } final NPC interact = World.getNpcs().get(index); - if (interact == null || interact.getDefinition() == null) { return; } - if (!interact.getDefinition().isAttackable()) { return; } - if (interact == null || interact.getHitpoints() <= 0) { player.getMovementQueue().reset(); return; } - player.getCombat().attack(interact); } private static void mageNpc(Player player, Packet packet) { int npcIndex = packet.readLEShortA(); int spellId = packet.readShortA(); - if (npcIndex < 0 || spellId < 0 || npcIndex > World.getNpcs().capacity()) { return; } - final NPC interact = World.getNpcs().get(npcIndex); - if (interact == null || interact.getDefinition() == null) { return; } - if (!interact.getDefinition().isAttackable()) { return; } - if (interact == null || interact.getHitpoints() <= 0) { player.getMovementQueue().reset(); return; } - CombatSpell spell = CombatSpells.getCombatSpell(spellId); - if (spell == null) { player.getMovementQueue().reset(); return; } - player.setPositionToFace(interact.getPosition()); player.getCombat().setCastSpell(spell); - player.getCombat().attack(interact); } diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/ObjectActionPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/ObjectActionPacketListener.java index c6e71d1..c4478c3 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/ObjectActionPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/ObjectActionPacketListener.java @@ -14,51 +14,91 @@ import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Animation; import com.elvarg.world.model.ForceMovement; +import com.elvarg.world.model.Item; import com.elvarg.world.model.MagicSpellbook; -import com.elvarg.world.model.PlayerRights; import com.elvarg.world.model.Position; import com.elvarg.world.model.Skill; -import com.elvarg.world.regions.AreaHandler; - -/** - * This packet listener is called when a player clicked on a game object. - * - * @author relex lawl - */ +import com.elvarg.world.model.container.impl.Inventory; public class ObjectActionPacketListener implements PacketListener { - private static void firstClick(final Player player, Packet packet) { - final int x = packet.readLEShortA(); - final int id = packet.readUnsignedShort(); - final int y = packet.readUnsignedShortA(); + private void itemOnObject(final Player player, Packet packet) { + int interfaceId = packet.readShort(); + int id = packet.readUnsignedShort(); + int y = packet.readLEShortA(); + int slot = packet.readUnsignedShort(); + int x = packet.readLEShortA(); + int z = player.getPosition().getZ(); + int itemId = packet.readShort(); + if (interfaceId != Inventory.INTERFACE_ID) { + return; + } + final Item interacted = player.getInventory().forSlot(slot); + if (interacted == null || itemId != interacted.getId() || slot != interacted.getSlot() + || !player.getInventory().contains(interacted.getId())) { + return; + } + final Position pos = new Position(x, y, z); + final GameObject object = new GameObject(id, pos); + if (!RegionClipping.objectExists(object) || object == null) { + return; + } + int distanceX = (player.getPosition().getX() - pos.getX()); + int distanceY = (player.getPosition().getY() - pos.getY()); + if (distanceX < 0) { + distanceX = -(distanceX); + } + if (distanceY < 0) { + distanceY = -(distanceY); + } + int size = distanceX > distanceY ? ObjectDefinition.forId(id).getSizeX() + : ObjectDefinition.forId(id).getSizeY(); + if (size <= 0) { + size = 1; + } + object.setSize(size); + player.setWalkToTask(new WalkToTask(player, pos, object.getSize(), new FinalizedMovementTask() { + @Override + public void execute() { + // execute code here for action + if (interacted.getId() == 995 && object.getId() == 409) { + player.getPacketSender().sendMessage("Hello world."); + return; + } + // example ^ + player.getPacketSender().sendMessage("Nothing interesting happens..."); + } + })); + System.out.println("Interacted with objectId: " + object.getId() + " with the itemId: " + itemId); + } + + private void firstClick(final Player player, Packet packet) { + int x = packet.readLEShortA(); + int id = packet.readUnsignedShort(); + int y = packet.readUnsignedShortA(); final Position position = new Position(x, y, player.getPosition().getZ()); final GameObject gameObject = new GameObject(id, position); if (id > 0 && id != 6 && !RegionClipping.objectExists(gameObject)) { - player.getPacketSender().sendMessage("An error occured. Error code: " + id) - .sendMessage("Please report the error to a staff member."); return; } int distanceX = (player.getPosition().getX() - position.getX()); int distanceY = (player.getPosition().getY() - position.getY()); - if (distanceX < 0) + if (distanceX < 0) { distanceX = -(distanceX); - if (distanceY < 0) + } + if (distanceY < 0) { distanceY = -(distanceY); + } int size = distanceX > distanceY ? ObjectDefinition.forId(id).getSizeX() : ObjectDefinition.forId(id).getSizeY(); - if (size <= 0) + if (size <= 0) { size = 1; + } gameObject.setSize(size); - if (player.getRights() == PlayerRights.DEVELOPER) - player.getPacketSender() - .sendMessage("First click object id; [id, position] : [" + id + ", " + position.toString() + "]"); player.setWalkToTask(new WalkToTask(player, position, gameObject.getSize(), new FinalizedMovementTask() { @Override public void execute() { - AreaHandler.firstClickObject(player, id); switch (id) { - case WILDERNESS_DITCH: player.getMovementQueue().reset(); if (player.getForceMovement() == null) { @@ -71,18 +111,15 @@ public void execute() { case LUNAR_ALTAR: case ANCIENT_ALTAR: - MagicSpellbook toChange = MagicSpellbook.ANCIENT; if (id == LUNAR_ALTAR) { toChange = MagicSpellbook.LUNAR; } - if (player.getSpellbook() == toChange) { player.setSpellbook(MagicSpellbook.NORMAL); } else { player.setSpellbook(toChange); } - Autocasting.setAutocast(player, null); player.getPacketSender().sendMessage("You have changed your magic spellbook.").sendTabInterface(6, player.getSpellbook().getInterfaceId()); @@ -97,39 +134,36 @@ public void execute() { player.getSkillManager().getMaxLevel(Skill.PRAYER), true); } else { player.getPacketSender() - .sendMessage("You don't need to recharge your Prayer points right now."); + .sendMessage("You don't need to recharge your prayer points right now."); } break; } + player.setPositionToFace(gameObject.getPosition()); } })); } - private static void secondClick(final Player player, Packet packet) { - final int id = packet.readLEShortA(); - final int y = packet.readLEShort(); - final int x = packet.readUnsignedShortA(); + private void secondClick(final Player player, Packet packet) { + int id = packet.readLEShortA(); + int y = packet.readLEShort(); + int x = packet.readUnsignedShortA(); final Position position = new Position(x, y, player.getPosition().getZ()); final GameObject gameObject = new GameObject(id, position); if (id > 0 && id != 6 && !RegionClipping.objectExists(gameObject)) { - // player.getPacketSender().sendMessage("An error occured. Error - // code: "+id).sendMessage("Please report the error to a staff - // member."); return; } player.setPositionToFace(gameObject.getPosition()); int distanceX = (player.getPosition().getX() - position.getX()); int distanceY = (player.getPosition().getY() - position.getY()); - if (distanceX < 0) + if (distanceX < 0) { distanceX = -(distanceX); - if (distanceY < 0) + } + if (distanceY < 0) { distanceY = -(distanceY); + } int size = distanceX > distanceY ? distanceX : distanceY; gameObject.setSize(size); - if (player.getRights() == PlayerRights.DEVELOPER) - player.getPacketSender() - .sendMessage("First click object id; [id, position] : [" + id + ", " + position.toString() + "]"); player.setWalkToTask(new WalkToTask(player, position, gameObject.getSize(), new FinalizedMovementTask() { @Override public void execute() { @@ -138,19 +172,20 @@ public void execute() { player.getBank(player.getCurrentBankTab()).open(); break; } + player.setPositionToFace(gameObject.getPosition()); } })); } - private static void thirdClick(Player player, Packet packet) { + private void thirdClick(Player player, Packet packet) { } - private static void fourthClick(Player player, Packet packet) { + private void fourthClick(Player player, Packet packet) { } - private static void fifthClick(final Player player, Packet packet) { + private void fifthClick(final Player player, Packet packet) { } @@ -175,6 +210,9 @@ public void handleMessage(Player player, Packet packet) { case PacketConstants.OBJECT_FIFTH_CLICK_OPCODE: fifthClick(player, packet); break; + case PacketConstants.ITEM_ON_OBJECT: + itemOnObject(player, packet); + break; } } diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/SwitchItemSlotPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/SwitchItemSlotPacketListener.java index 3dfaf6b..19d3e92 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/SwitchItemSlotPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/SwitchItemSlotPacketListener.java @@ -16,26 +16,22 @@ public class SwitchItemSlotPacketListener implements PacketListener { @Override public void handleMessage(Player player, Packet packet) { - if (player.getHitpoints() <= 0) + if (player.getHitpoints() <= 0) { return; + } int interfaceId = packet.readInt(); packet.readByteC(); int fromSlot = packet.readLEShortA(); int toSlot = packet.readLEShort(); - // Bank.. if (interfaceId >= Bank.CONTAINER_START && interfaceId < Bank.CONTAINER_START + Bank.TOTAL_BANK_TABS) { - final int tab = player.isSearchingBank() ? Bank.BANK_SEARCH_TAB_INDEX : interfaceId - Bank.CONTAINER_START; - if (fromSlot >= 0 && fromSlot < player.getBank(tab).capacity() && toSlot >= 0 && toSlot < player.getBank(tab).capacity() && toSlot != fromSlot) { Bank.rearrange(player, player.getBank(tab), fromSlot, toSlot); } - return; } - switch (interfaceId) { case Inventory.INTERFACE_ID: case Bank.INVENTORY_INTERFACE_ID: diff --git a/Elvarg - Server/src/com/elvarg/net/packet/impl/TradeRequestPacketListener.java b/Elvarg - Server/src/com/elvarg/net/packet/impl/TradeRequestPacketListener.java index b3225b5..b07c36e 100644 --- a/Elvarg - Server/src/com/elvarg/net/packet/impl/TradeRequestPacketListener.java +++ b/Elvarg - Server/src/com/elvarg/net/packet/impl/TradeRequestPacketListener.java @@ -14,25 +14,19 @@ public void handleMessage(Player player, Packet packet) { if (index > World.getPlayers().capacity() || index < 0) { return; } - if (player.busy()) { player.getPacketSender().sendMessage("You cannot do that right now."); return; } - Player p_ = World.getPlayers().get(index); - if (p_.busy()) { String msg = "That player is currently busy."; - if (p_.getStatus() == PlayerStatus.TRADING) { msg = "That player is currently trading with someone else."; } - player.getPacketSender().sendMessage(msg); return; } - if (p_ != null && player.getLocalPlayers().contains(p_)) { player.getTrading().requestTrade(p_); } diff --git a/Elvarg - Server/src/com/elvarg/world/World.java b/Elvarg - Server/src/com/elvarg/world/World.java index 42463ca..de5b23f 100644 --- a/Elvarg - Server/src/com/elvarg/world/World.java +++ b/Elvarg - Server/src/com/elvarg/world/World.java @@ -11,7 +11,6 @@ import com.elvarg.Elvarg; import com.elvarg.GameConstants; import com.elvarg.util.Misc; -import com.elvarg.world.content.ServerFeed; import com.elvarg.world.entity.impl.CharacterList; import com.elvarg.world.entity.impl.npc.NPC; import com.elvarg.world.entity.impl.object.ObjectHandler; @@ -223,8 +222,5 @@ public static void sequence() { // Objects updating ObjectHandler.process(); - - // Misc updating - ServerFeed.updateEntries(); } } diff --git a/Elvarg - Server/src/com/elvarg/world/collision/region/RegionClipping.java b/Elvarg - Server/src/com/elvarg/world/collision/region/RegionClipping.java index 4b8b252..2316da4 100644 --- a/Elvarg - Server/src/com/elvarg/world/collision/region/RegionClipping.java +++ b/Elvarg - Server/src/com/elvarg/world/collision/region/RegionClipping.java @@ -603,12 +603,6 @@ public static boolean blockedSouthWest(Position pos) { } public static boolean canProjectileAttack(Character a, Character b) { - if (!a.isPlayer()) { - if (b.isPlayer()) { - return canProjectileMove(b.getPosition().getX(), b.getPosition().getY(), a.getPosition().getX(), - a.getPosition().getY(), a.getPosition().getZ(), 1, 1); - } - } return canProjectileMove(a.getPosition().getX(), a.getPosition().getY(), b.getPosition().getX(), b.getPosition().getY(), a.getPosition().getZ(), 1, 1); } diff --git a/Elvarg - Server/src/com/elvarg/world/content/ItemsKeptOnDeath.java b/Elvarg - Server/src/com/elvarg/world/content/ItemsKeptOnDeath.java index d3b2c6c..e8745a9 100644 --- a/Elvarg - Server/src/com/elvarg/world/content/ItemsKeptOnDeath.java +++ b/Elvarg - Server/src/com/elvarg/world/content/ItemsKeptOnDeath.java @@ -5,6 +5,7 @@ import java.util.Comparator; import com.elvarg.util.Misc; +import com.elvarg.world.content.skills.prayer.PrayerHandler; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Item; diff --git a/Elvarg - Server/src/com/elvarg/world/content/ServerFeed.java b/Elvarg - Server/src/com/elvarg/world/content/ServerFeed.java deleted file mode 100644 index c7f0012..0000000 --- a/Elvarg - Server/src/com/elvarg/world/content/ServerFeed.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.elvarg.world.content; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -import com.elvarg.world.World; -import com.elvarg.world.entity.impl.player.Player; -import com.elvarg.world.model.SecondsTimer; - -public class ServerFeed { - - public static final int SKULL_SPRITE = 162; - public static final int INTERFACE_ID = 38000; - private static final int MAX_ENTRIES = 13; - private static final int FRAME_START = 38001; - - public static final List ENTRIES = new CopyOnWriteArrayList(); - - final static class FeedEntry { - String entry; - SecondsTimer timer; - - public FeedEntry(String entry, int seconds) { - this.entry = entry; - this.timer = new SecondsTimer(seconds); - } - } - - public static void submit(final String s, final int seconds) { - FeedEntry entry = new FeedEntry(s, seconds); - if (ENTRIES.size() >= MAX_ENTRIES) { - ENTRIES.remove(0); - } - ENTRIES.add(entry); - updateInterface(); - } - - public static void updateEntries() { - boolean updateInterface = false; - for (FeedEntry e : ENTRIES) { - if (e == null || e.timer == null || e.timer.finished()) { - ENTRIES.remove(e); - updateInterface = true; - } - } - if (updateInterface) { - updateInterface(); - } - } - - public static void updateInterface() { - for (Player p : World.getPlayers()) { - if (p == null) { - continue; - } - updateInterface(p); - } - } - - public static void updateInterface(Player p) { - for (int i = 0, frame = FRAME_START; i < MAX_ENTRIES; i++, frame++) { - p.getPacketSender().sendString(frame, (i < ENTRIES.size() ? ENTRIES.get(i).entry : "")); - } - } -} diff --git a/Elvarg - Server/src/com/elvarg/world/content/clan/ClanChatManager.java b/Elvarg - Server/src/com/elvarg/world/content/clan/ClanChatManager.java index e26e41f..54cf088 100644 --- a/Elvarg - Server/src/com/elvarg/world/content/clan/ClanChatManager.java +++ b/Elvarg - Server/src/com/elvarg/world/content/clan/ClanChatManager.java @@ -11,9 +11,7 @@ import java.util.Map.Entry; import com.elvarg.util.Misc; -import com.elvarg.world.entity.impl.npc.NPC; import com.elvarg.world.entity.impl.player.Player; -import com.elvarg.world.model.Item; import com.elvarg.world.model.dialogue.DialogueManager; import com.elvarg.world.model.dialogue.DialogueOptions; import com.elvarg.world.model.syntax.impl.JoinClanChat; @@ -561,10 +559,8 @@ public static boolean handleButton(Player player, int button, int menuId) { // Other buttons.. switch (button) { case 37132: // CC Setup - if (!player.busy()) { if (getClanChatChannel(player) == null) { - player.setDialogueOptions(new DialogueOptions() { @Override public void handleOption1(Player player) { @@ -577,15 +573,12 @@ public void handleOption2(Player player) { player.getPacketSender().sendInterfaceRemoval(); } }); - DialogueManager.start(player, 9); - return true; } } else { player.getPacketSender().sendMessage("You cannot do that right now."); } - return true; case 37129: // Join / Leave clan @@ -601,72 +594,6 @@ public void handleOption2(Player player) { return false; } - public static boolean dropShareLoot(Player player, NPC npc, Item itemDropped) { - /* - * ClanChat clan = player.getFields().getClanChat(); if (clan != null) { - * boolean received = false; List players = - * getPlayersWithinPosition(clan, npc.getPosition()); String green = - * ""; if (clan.isItemSharing() && itemDropped.getId() != 995) { Player - * rewarded = players.size() > 0 ? - * players.get(MathUtils.random(players.size() - 1)) : null; if - * (rewarded != null) { rewarded.getPacketSender().sendMessage(green + - * "You have received " + itemDropped.getAmount() + "x " + - * itemDropped.getDefinition().getName() + "."); received = true; } } if - * (clan.isCoinSharing() && itemDropped.getId() == 995) { for (Item drop - * : npc.getDrops()) { if ((drop.getDefinition().getValue() * - * drop.getAmount()) < 50000) { GroundItem groundItem = new - * GroundItem(drop, npc.getPosition().copy()); - * GameServer.getWorld().register(groundItem, player); continue; } int - * amount = (int) (ItemDefinition.forId(drop.getId()).getValue() / - * players.size()); Item split = new Item(995, amount); for (Player - * member : players) { GroundItem groundItem = new - * GroundItem(split.copy(), npc.getPosition().copy()); - * GameServer.getWorld().register(groundItem, member); - * member.getPacketSender().sendMessage(green + "You have received " + - * amount + "x " + split.getDefinition().getName() + - * " as part of a split drop."); } } } else if(!clan.isItemSharing() && - * !clan.isCoinSharing() || !received) return false; } else return - * false; - */ - return false; - } - - public static void toggleLootShare(Player player) { - final ClanChat clan = player.getCurrentClanChat(); - if (clan == null) { - player.getPacketSender().sendMessage("You're not in a clan channel."); - return; - } - if (!player.getRights().isStaff()) { - if (clan.getOwner() == null) - return; - if (!clan.getOwner().equals(player)) { - player.getPacketSender().sendMessage("Only the owner of the channel has the power to do this."); - return; - } - } - if (clan.getLastAction().elapsed(5000) || player.getRights().isStaff()) { - clan.setLootShare(!clan.getLootShare()); - sendMessage(clan, "[" + clan.getName() + "] " - + player.getUsername() + " has " + (clan.getLootShare() ? "enabled" : "disabled") + " Lootshare."); - for (Player member : clan.getMembers()) { - if (member != null) { - // member.getPacketSender().sendString(29454, "Lootshare: - // "+getLootshareStatus(clan)); - } - } - clan.getLastAction().reset(); - } else { - player.getPacketSender().sendMessage("You need to wait a few seconds between every clanchat action."); - } - } - - private static String getLootshareStatus(ClanChat clan) { - return clan.getLootShare() ? "@gre@On" : "Off"; - } - private static int getIndex() { for (int i = 0; i < clans.length; i++) { if (clans[i] == null) { diff --git a/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/CreateFinishedPotionTask.java b/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/CreateFinishedPotionTask.java index 5fb9e05..1eb14fd 100644 --- a/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/CreateFinishedPotionTask.java +++ b/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/CreateFinishedPotionTask.java @@ -38,13 +38,16 @@ public CreateFinishedPotionTask(Player player, Optional poti public void start(Player player) { if (potion.isPresent()) { - if (player.getSkillManager().getCurrentLevel(Skill.HERBLORE) >= potion.get().getRequirement()) { - TaskManager.submit(new CreateFinishedPotionTask(player, potion, amount)); - } else { - DialogueManager.sendStatement(player, "You need a Herblore level of atleast " - + potion.get().getRequirement() + " to make this potion."); - player.getPacketSender().sendMessage("You need a Herblore level of atleast " - + potion.get().getRequirement() + " to make this potion."); + if (player.getInventory() + .contains(new Item[] { potion.get().getIngredient(), potion.get().getUnfinishedPotion() })) { + if (player.getSkillManager().getCurrentLevel(Skill.HERBLORE) >= potion.get().getRequirement()) { + TaskManager.submit(new CreateFinishedPotionTask(player, potion, amount)); + } else { + DialogueManager.sendStatement(player, "You need a Herblore level of atleast " + + potion.get().getRequirement() + " to make this potion."); + player.getPacketSender().sendMessage("You need a Herblore level of atleast " + + potion.get().getRequirement() + " to make this potion."); + } } } } @@ -74,7 +77,6 @@ protected void execute() { this.stop(); } } else { - DialogueManager.sendStatement(player, "You have ran out of the ingredients required."); player.getPacketSender().sendMessage("You have ran out of the ingredients required."); this.stop(); } diff --git a/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/CreateUnfinishedPotionTask.java b/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/CreateUnfinishedPotionTask.java index 8dd2785..d190233 100644 --- a/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/CreateUnfinishedPotionTask.java +++ b/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/CreateUnfinishedPotionTask.java @@ -32,7 +32,7 @@ public class CreateUnfinishedPotionTask extends Task { private int amount; public CreateUnfinishedPotionTask(Player player, Optional potion, int amount) { - super(4, player, true); + super(3, player, true); this.player = player; this.potion = potion; this.amount = amount; @@ -40,13 +40,16 @@ public CreateUnfinishedPotionTask(Player player, Optional public void start(Player player) { if (potion.isPresent()) { - if (player.getSkillManager().getCurrentLevel(Skill.HERBLORE) >= potion.get().getRequirement()) { - TaskManager.submit(new CreateUnfinishedPotionTask(player, potion, amount)); - } else { - DialogueManager.sendStatement(player, "You need a Herblore level of atleast " - + potion.get().getRequirement() + " to make this potion."); - player.getPacketSender().sendMessage("You need a Herblore level of atleast " - + potion.get().getRequirement() + " to make this potion."); + if (player.getInventory() + .contains(new Item[] { potion.get().getIngredient(), new Item(VIAL_OF_WATER, 1) })) { + if (player.getSkillManager().getCurrentLevel(Skill.HERBLORE) >= potion.get().getRequirement()) { + TaskManager.submit(new CreateUnfinishedPotionTask(player, potion, amount)); + } else { + DialogueManager.sendStatement(player, "You need a Herblore level of atleast " + + potion.get().getRequirement() + " to make this potion."); + player.getPacketSender().sendMessage("You need a Herblore level of atleast " + + potion.get().getRequirement() + " to make this potion."); + } } } } @@ -75,7 +78,6 @@ protected void execute() { this.stop(); } } else { - DialogueManager.sendStatement(player, "You have ran out of the ingredients required."); player.getPacketSender().sendMessage("You have ran out of the ingredients required."); this.stop(); } diff --git a/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/HerbSack.java b/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/HerbSack.java new file mode 100644 index 0000000..1941902 --- /dev/null +++ b/Elvarg - Server/src/com/elvarg/world/content/skills/herblore/HerbSack.java @@ -0,0 +1,104 @@ +package com.elvarg.world.content.skills.herblore; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.Objects; +import java.util.function.Predicate; + +import com.elvarg.cache.impl.definitions.ItemDefinition; +import com.elvarg.world.entity.impl.player.Player; +import com.elvarg.world.model.Item; +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Multiset; +import com.google.common.collect.Multisets; + +/** + * Handles all functionality for the Herb Sack item from OSRS. + * + * @author Andys1814. + */ +public final class HerbSack { + + private Player player; + + public HerbSack(Player player) { + this.player = player; + } + + /** + * This collection handles the constants of the Herb Sack. + */ + private final Multiset herbSack = HashMultiset.create(); + + /** + * Handles the action of filling the Herb Sack. + */ + public void fillSack() { + player.getPacketSender().sendMessage("You search your inventory for herbs appropriate to put in the sack..."); + if (Arrays.stream(player.getInventory().getItems()).noneMatch(isGrimyHerb())) { + player.getPacketSender().sendMessage("There are no herbs in your inventory that can be added to the sack."); + return; + } + Arrays.stream(player.getInventory().getItems()).filter(Objects::nonNull).filter(isGrimyHerb()).forEach(herb -> { + if (herbSack.count(herb.getId()) < 30) { + herbSack.add(herb.getId()); + player.getInventory().delete(herb); + } + }); + player.getPacketSender().sendMessage("You add the herb(s) to your sack."); + } + + /** + * Handles the action of emptying the Herb Sack + */ + public void emptySack() { + if (herbSack.isEmpty()) { + player.getPacketSender().sendMessage("The herb sack is already empty."); + return; + } + if (player.getInventory().getFreeSlots() <= 0) { + player.getPacketSender() + .sendMessage("You don't have enough inventory space to empty the contents of this sack."); + return; + } + for (Iterator it = herbSack.iterator(); it.hasNext();) { + if (player.getInventory().getFreeSlots() <= 0) { + return; + } + int herb = it.next(); + System.out.println("removing item : " + herb); + player.getInventory().add(new Item(herb)); + it.remove(); + } + } + + /** + * Handles the action of checking the contents of the Herb Sack. It will + * automatically outprint the herbs which have the highest amount of herbs, + * thanks to {@link Multisets#copyHighestCountFirst}. + */ + public void checkSack() { + player.getPacketSender().sendMessage("You look in your herb sack and see:"); + if (herbSack.isEmpty()) { + player.getPacketSender().sendMessage("The herb sack is empty."); + return; + } + for (int herbId : Multisets.copyHighestCountFirst(herbSack).elementSet()) { + player.getPacketSender() + .sendMessage(herbSack.count(herbId) + " x " + ItemDefinition.getDefinitions()[herbId].getName()); + } + } + + /** + * This predicate method is used while filling the sack to filter out items + * that are not allowed to be stored in the sack. Basically, anything with + * "Grimy" in the name can be stored in the sack so we generalize it as + * such. + * + * @return The result of the predicate function. + */ + private final Predicate isGrimyHerb() { + return herb -> herb.getDefinition().getName().contains("Grimy"); + } + +} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/content/skills/prayer/BoneBurying.java b/Elvarg - Server/src/com/elvarg/world/content/skills/prayer/BoneBurying.java new file mode 100644 index 0000000..b3e0327 --- /dev/null +++ b/Elvarg - Server/src/com/elvarg/world/content/skills/prayer/BoneBurying.java @@ -0,0 +1,91 @@ +package com.elvarg.world.content.skills.prayer; + +import java.util.HashMap; +import java.util.Map; + +import com.elvarg.cache.impl.definitions.ItemDefinition; +import com.elvarg.world.entity.impl.player.Player; +import com.elvarg.world.model.Animation; +import com.elvarg.world.model.Item; +import com.elvarg.world.model.Priority; +import com.elvarg.world.model.Skill; + +public enum BoneBurying { + + BAT_BONES(new Item(530), 5.3), + + BIG_BONES(new Item(532), 15), + + JOGRE_BONES(new Item(3125), 15), + + ZOGRE_BONES(new Item(4812), 12.5), + + BONES(new Item(526), 4.5), + + WYVERN_BONES(new Item(6812), 50), + + DRAGON_BONES(new Item(536), 72), + + FAYRG(new Item(4830), 84), + + RAURG_BONES(new Item(4832), 96), + + DAGANNOTH(new Item(6729), 125), + + WOLF_BONES(new Item(2859), 4.5), + + BURNST_BONES(new Item(528), 4.5), + + MONKEY_BONES(new Item(3183), 5), + + MONKEY_BONES2(new Item(3179), 5), + + SHAIKAHAN_BONES(new Item(3123), 25), + + BABY_DRAGON_BONES(new Item(534), 30), + + OURG_BONES(new Item(4834), 140); + + private final Item item; + + private final double experience; + + private static Map bone = new HashMap(); + + static { + for (BoneBurying b : BoneBurying.values()) { + bone.put(b.getBone().getId(), b); + } + } + + public static BoneBurying forId(int id) { + return bone.get(id); + } + + private BoneBurying(final Item item, final double experience) { + this.item = item; + this.experience = experience; + } + + public Item getBone() { + return item; + } + + public double getExperience() { + return experience; + } + + private static final Animation BURY = new Animation(827, Priority.LOW); + + public static void bury(final Player player, final BoneBurying bone, Item item) { + if (bone == null) { + return; + } + player.performAnimation(BURY); + player.getSkillManager().addExperience(Skill.PRAYER, (int) bone.getExperience()); + player.getPacketSender() + .sendMessage("You bury the " + ItemDefinition.forId(item.getId()).getName().toLowerCase() + "."); + player.getInventory().delete(item, item.getSlot()); + + } +} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/content/PrayerHandler.java b/Elvarg - Server/src/com/elvarg/world/content/skills/prayer/PrayerHandler.java similarity index 99% rename from Elvarg - Server/src/com/elvarg/world/content/PrayerHandler.java rename to Elvarg - Server/src/com/elvarg/world/content/skills/prayer/PrayerHandler.java index 4145f98..1938143 100644 --- a/Elvarg - Server/src/com/elvarg/world/content/PrayerHandler.java +++ b/Elvarg - Server/src/com/elvarg/world/content/skills/prayer/PrayerHandler.java @@ -1,4 +1,4 @@ -package com.elvarg.world.content; +package com.elvarg.world.content.skills.prayer; import java.util.HashMap; diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/CombatFactory.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/CombatFactory.java index 9036791..67b672a 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/CombatFactory.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/CombatFactory.java @@ -11,7 +11,7 @@ import com.elvarg.net.SessionState; import com.elvarg.util.Misc; import com.elvarg.world.collision.region.RegionClipping; -import com.elvarg.world.content.PrayerHandler; +import com.elvarg.world.content.skills.prayer.PrayerHandler; import com.elvarg.world.entity.combat.formula.DamageFormulas; import com.elvarg.world.entity.combat.hit.HitDamage; import com.elvarg.world.entity.combat.hit.HitMask; @@ -26,7 +26,6 @@ import com.elvarg.world.entity.impl.npc.NPCMovementCoordinator.CoordinateState; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Animation; -import com.elvarg.world.model.EffectTimer; import com.elvarg.world.model.Flag; import com.elvarg.world.model.Graphic; import com.elvarg.world.model.Item; @@ -221,23 +220,20 @@ public static boolean canReach(Character attacker, CombatMethod method, Characte // Check good distance? if (!(attacker.getPosition().isWithinDistance(target.getPosition(), distance))) { return false; - } else { - // Stop running forward if we're in distance. - attacker.getMovementQueue().reset(); } - // Check blocked projectiles - if (method.getCombatType() != CombatType.MELEE) { - /* - * if(!RegionClipping.canProjectileAttack(attacker, target)) { - * return false; } - */ - } else { - // Check diagonal block - if (RegionClipping.isInDiagonalBlock(attacker, target)) { - RS317PathFinder.solveDiagonalBlock(attacker, target); - return false; - } + // Stop running forward if we're in distance. + attacker.getMovementQueue().reset(); + + // Check diagonal + if (RegionClipping.isInDiagonalBlock(attacker, target)) { + RS317PathFinder.solveDiagonalBlock(attacker, target); + return false; + } + + // Check projectiles.. + if (!RegionClipping.canProjectileAttack(attacker, target)) { + return false; } // Check same spot @@ -602,25 +598,19 @@ public static void checkGuthans(Player player, Character target, int damage) { } public static void checkSkull(Player attacker, Player target) { - if (attacker.isSkulled()) { return; } - // We've probably already been skulled by this player. if (target.getCombat().damageMapContains(attacker) || attacker.getCombat().damageMapContains(target)) { return; } - if (target.getCombat().getAttacker() != null && target.getCombat().getAttacker() == attacker) { return; } - if (attacker.getCombat().getAttacker() != null && attacker.getCombat().getAttacker() == target) { return; } - - attacker.getPacketSender().sendMessage("@red@You have been skulled!"); attacker.setSkullTimer(600); // 6 minutes exactly. attacker.getUpdateFlag().flag(Flag.APPEARANCE); @@ -628,27 +618,21 @@ public static void checkSkull(Player attacker, Player target) { public static void checkAutoretaliate(Character attacker, Character target) { if (!CombatFactory.isAttacking(target)) { - boolean auto_ret; - if (target.isPlayer()) { auto_ret = target.getCombat().autoRetaliate() && target.getMovementQueue().isMovementDone(); } else { auto_ret = target.getAsNpc().getMovementCoordinator().getCoordinateState() == CoordinateState.HOME; } - if (!auto_ret) { return; } - // Start a task, don't autoretaliate immediately TaskManager.submit(new Task(1, attacker, false) { @Override protected void execute() { - // Double check reqs again target.getCombat().attack(attacker); - stop(); } }); @@ -660,23 +644,17 @@ public static void freeze(Character character, int seconds) { if (!character.getCombat().getFreezeTimer().finished()) { return; } - // Add check for npc: Only small npcs should be freeze-able if (character.isNpc()) { // if(size > 1) { // return; // } } - character.getCombat().getFreezeTimer().start(seconds); character.getMovementQueue().reset(); - if (character.isPlayer()) { - - // Send message and effect timer to client - character.getAsPlayer().getPacketSender().sendMessage("You have been frozen!").sendEffectTimer(seconds, - EffectTimer.FREEZE); - + // Send message to the character + character.getAsPlayer().getPacketSender().sendMessage("You have been frozen!"); // Actually reset combat too // I think it's that way on osrs character.getCombat().reset(); @@ -684,7 +662,6 @@ public static void freeze(Character character, int seconds) { } public static void checkPrayerEffects(Character attacker, Player victim, int damage, CombatType type) { - // Handle redemption here if (PrayerHandler.isActivated(victim, PrayerHandler.REDEMPTION) && victim.getHitpoints() <= (victim.getSkillManager().getMaxLevel(Skill.HITPOINTS) / 10)) { @@ -698,11 +675,8 @@ public static void checkPrayerEffects(Character attacker, Player victim, int dam PrayerHandler.deactivatePrayers(victim); return; } - if (attacker.isPlayer()) { - Player p = (Player) attacker; - // The retribution prayer effect. if (PrayerHandler.isActivated(victim, PrayerHandler.RETRIBUTION) && victim.getHitpoints() < 1) { victim.performGraphic(new Graphic(437)); @@ -711,7 +685,6 @@ public static void checkPrayerEffects(Character attacker, Player victim, int dam new HitDamage(Misc.getRandom(CombatConstants.MAXIMUM_RETRIBUTION_DAMAGE), HitMask.RED)); } } - // Handle smite effect here if (PrayerHandler.isActivated((Player) attacker, PrayerHandler.SMITE)) { victim.getSkillManager().setCurrentLevel(Skill.PRAYER, diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/CombatSpecial.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/CombatSpecial.java index 8552147..47f98b1 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/CombatSpecial.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/CombatSpecial.java @@ -164,10 +164,9 @@ public static void updateBar(Player player) { --specialBar); specialCheck--; } - player.getPacketSender().updateSpecialAttackOrb().sendString(player.getCombat().getWeapon().getSpecialMeter(), + player.getPacketSender().sendString(player.getCombat().getWeapon().getSpecialMeter(), player.isSpecialActivated() ? ("@yel@ Special Attack (" + player.getSpecialPercentage() + "%)") : ("@bla@ Special Attack (" + player.getSpecialPercentage() + "%")); - } /** diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/formula/AccuracyFormulas.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/formula/AccuracyFormulas.java index ae11bda..c9f5a2a 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/formula/AccuracyFormulas.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/formula/AccuracyFormulas.java @@ -1,7 +1,7 @@ package com.elvarg.world.entity.combat.formula; import com.elvarg.util.Misc; -import com.elvarg.world.content.PrayerHandler; +import com.elvarg.world.content.skills.prayer.PrayerHandler; import com.elvarg.world.entity.combat.CombatConstants; import com.elvarg.world.entity.combat.CombatEquipment; import com.elvarg.world.entity.combat.CombatFactory; diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/formula/DamageFormulas.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/formula/DamageFormulas.java index 47eead6..656db40 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/formula/DamageFormulas.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/formula/DamageFormulas.java @@ -1,6 +1,6 @@ package com.elvarg.world.entity.combat.formula; -import com.elvarg.world.content.PrayerHandler; +import com.elvarg.world.content.skills.prayer.PrayerHandler; import com.elvarg.world.entity.combat.CombatEquipment; import com.elvarg.world.entity.combat.CombatFactory; import com.elvarg.world.entity.combat.CombatType; diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/CombatSpells.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/CombatSpells.java index c5e515b..ed5ceed 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/CombatSpells.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/CombatSpells.java @@ -4,12 +4,11 @@ import java.util.Optional; import com.elvarg.engine.task.impl.CombatPoisonEffect.PoisonType; -import com.elvarg.world.content.PrayerHandler; +import com.elvarg.world.content.skills.prayer.PrayerHandler; import com.elvarg.world.entity.combat.CombatFactory; import com.elvarg.world.entity.impl.Character; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Animation; -import com.elvarg.world.model.EffectTimer; import com.elvarg.world.model.Graphic; import com.elvarg.world.model.GraphicHeight; import com.elvarg.world.model.Item; @@ -18,6 +17,7 @@ import com.elvarg.world.model.Skill; public enum CombatSpells { + WIND_STRIKE(new CombatNormalSpell() { @Override public Optional castAnimation() { @@ -98,17 +98,7 @@ public void spellEffect(Character cast, Character castOn) { player.getSkillManager().updateSkill(Skill.ATTACK); player.getPacketSender().sendMessage("You feel slightly weakened."); - } /* - * else if (castOn.isNpc()) { NPC npc = (NPC) castOn; - * - * if (npc.getDefenceWeakened()[0] || - * npc.getStrengthWeakened()[0]) { if (cast.isPlayer()) { - * ((Player) cast).getPacketSender().sendMessage( - * "The spell has no effect because the NPC has already been weakened." - * ); } return; } - * - * npc.getDefenceWeakened()[0] = true; } - */ + } } @Override @@ -1731,7 +1721,6 @@ public Optional castProjectile(Character cast, Character castOn) { public void spellEffect(Character cast, Character castOn) { if (castOn.isPlayer()) { Player player = (Player) castOn; - if (!player.getCombat().getTeleBlockTimer().finished()) { if (cast.isPlayer()) { ((Player) cast).getPacketSender() @@ -1739,13 +1728,9 @@ public void spellEffect(Character cast, Character castOn) { } return; } - final int seconds = player.getPrayerActive()[PrayerHandler.PROTECT_FROM_MAGIC] ? 300 : 600; - player.getCombat().getTeleBlockTimer().start(seconds); - player.getPacketSender().sendEffectTimer(seconds, EffectTimer.TELE_BLOCK) - .sendMessage("You have just been teleblocked!"); - + player.getPacketSender().sendMessage("You have just been teleblocked!"); } else if (castOn.isNpc()) { if (cast.isPlayer()) { ((Player) cast).getPacketSender().sendMessage("Your spell has no effect on this target."); diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/MagicClickSpells.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/MagicClickSpells.java index d81ad02..5d2f6fe 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/MagicClickSpells.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/MagicClickSpells.java @@ -5,11 +5,11 @@ import com.elvarg.world.entity.impl.Character; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Animation; -import com.elvarg.world.model.EffectTimer; import com.elvarg.world.model.Graphic; import com.elvarg.world.model.GraphicHeight; import com.elvarg.world.model.Item; import com.elvarg.world.model.MagicSpellbook; +import com.elvarg.world.model.Priority; public class MagicClickSpells { @@ -332,35 +332,19 @@ public Spell getSpell() { public static boolean handleSpell(Player player, int button) { switch (button) { case VENGEANCE_SPELL_BUTTON: - /* - * if(!player.getLocation().isAidingAllowed() || - * player.getLocation() == Location.DUEL_ARENA) { - * player.getPacketSender(). - * sendMessage("This spell cannot be cast here."); return true; } - */ if (!MagicSpells.VENGEANCE.getSpell().canCast(player, false)) { return true; } - /* - * if(player.hasVengeance()) { player.getPacketSender(). - * sendMessage("You already have Vengeance's effect."); return true; - * } - */ - if (!player.getVengeanceTimer().finished()) { - player.getPacketSender().sendMessage("This spell can only be cast once every 30 seconds."); + player.getPacketSender().sendMessage("You must wait another " + + player.getVengeanceTimer().secondsRemaining() + " seconds before casting this."); return true; } - // Send message and effect timer to client - player.setHasVengeance(true); player.getVengeanceTimer().start(30); - player.getPacketSender().sendEffectTimer(30, EffectTimer.VENGEANCE) - .sendMessage("You now have Vengeance's effect."); - player.getInventory().deleteItemSet(MagicSpells.VENGEANCE.getSpell().itemsRequired(player)); - player.performAnimation(new Animation(4410)); + player.performAnimation(new Animation(4410, Priority.HIGH)); player.performGraphic(new Graphic(726, GraphicHeight.HIGH)); return true; } diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/Spell.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/Spell.java index 66a9dea..cd0f471 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/Spell.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/magic/Spell.java @@ -29,7 +29,6 @@ public abstract class Spell { * false otherwise. */ public boolean canCast(Player player, boolean delete) { - // We first check the level required. if (player.getSkillManager().getCurrentLevel(Skill.MAGIC) < levelRequired()) { player.getPacketSender() @@ -37,7 +36,6 @@ public boolean canCast(Player player, boolean delete) { player.getCombat().reset(); return false; } - // Secondly we check if they have proper magic spellbook // If not, reset all magic attributes such as current spell // Aswell as autocast spell @@ -47,24 +45,19 @@ public boolean canCast(Player player, boolean delete) { player.getCombat().reset(); return false; } - // Then we check the items required. if (itemsRequired(player).isPresent()) { - // Suppress the runes based on the staff, we then use the new array // of items that don't include suppressed runes. Item[] items = PlayerMagicStaff.suppressRunes(player, itemsRequired(player).get()); - // Now check if we have all of the runes. if (!player.getInventory().containsAll(items)) { - // We don't, so we can't cast. player.getPacketSender().sendMessage("You do not have the required items to cast this spell."); player.getCombat().setCastSpell(null); player.getCombat().reset(); return false; } - // Finally, we check the equipment required. if (equipmentRequired(player).isPresent()) { if (!player.getEquipment().containsAll(equipmentRequired(player).get())) { @@ -74,7 +67,6 @@ public boolean canCast(Player player, boolean delete) { return false; } } - // We've made it through the checks, so we have the items and can // remove them now. if (delete) { diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/method/impl/RangedCombatMethod.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/method/impl/RangedCombatMethod.java index 3e2628f..a7e2951 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/method/impl/RangedCombatMethod.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/method/impl/RangedCombatMethod.java @@ -6,6 +6,7 @@ import com.elvarg.world.entity.combat.ranged.RangedData; import com.elvarg.world.entity.combat.ranged.RangedData.AmmunitionData; import com.elvarg.world.entity.combat.ranged.RangedData.RangedWeaponData; +import com.elvarg.world.entity.combat.ranged.RangedData.RangedWeaponType; import com.elvarg.world.entity.impl.Character; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.model.Animation; @@ -56,16 +57,39 @@ public boolean canAttack(Character character, Character target) { public void onQueueAdd(Character character, Character target) { if (character.isPlayer()) { AmmunitionData ammo = character.getAsPlayer().getCombat().getAmmunition(); - new Projectile(character, target, ammo.getProjectileId(), ammo.getProjectileDelay() + 16, - ammo.getProjectileSpeed() + 28, ammo.getStartHeight(), ammo.getEndHeight(), 0).sendProjectile(); + RangedWeaponData rangedWeapon = character.getCombat().getRangedWeaponData(); + + int projectileId = ammo.getProjectileId(); + int delay = 40; + int speed = 60; + int heightEnd = 31; + int heightStart = 43; + int curve = 0; + + if (rangedWeapon.getType() == RangedWeaponType.CROSSBOW) { + delay = 46; + speed = 62; + heightStart = 44; + heightEnd = 35; + curve = 3; + } else if (ammo == AmmunitionData.TOKTZ_XIL_UL) { + delay = 30; + speed = 55; + } + + new Projectile(character, target, projectileId, delay, speed, heightStart, heightEnd, curve) + .sendProjectile(); RangedData.decrementAmmo(character.getAsPlayer(), target.getPosition()); // Dark bow sends two arrows, so send another projectile and delete // another arrow. if (character.getCombat().getRangedWeaponData() == RangedWeaponData.DARK_BOW) { - new Projectile(character, target, ammo.getProjectileId(), ammo.getProjectileDelay() + 35, - ammo.getProjectileSpeed() + 28, ammo.getStartHeight(), ammo.getEndHeight(), 0).sendProjectile(); + // new Projectile(character, target, ammo.getProjectileId(), + // ammo.getProjectileDelay() + 35, ammo.getProjectileSpeed() + + // 28, ammo.getStartHeight(), ammo.getEndHeight(), + // 0).sendProjectile(); + new Projectile(character, target, ammo.getProjectileId(), 60, 80, 43, 31, 0).sendProjectile(); RangedData.decrementAmmo(character.getAsPlayer(), target.getPosition()); } } @@ -78,6 +102,9 @@ public int getAttackSpeed(Character character) { @Override public int getAttackDistance(Character character) { + if (character.isPlayer()) { + return character.getAsPlayer().getCombat().getRangedWeaponData().getType().getDistanceRequired(); + } return 6; } @@ -91,10 +118,9 @@ public void startAnimation(Character character) { if (character.isPlayer()) { AmmunitionData ammo = character.getAsPlayer().getCombat().getAmmunition(); - // character.getAsPlayer().performGraphic(new - // Graphic(ammo.getStartGfxId(), ammo.getStartGfxId() == 2138 ? - // GraphicHeight.LOW : ammo.getStartHeight() >= 43 ? - // GraphicHeight.HIGH : GraphicHeight.MIDDLE)); + if (ammo.getStartGraphic() != null) { + character.getAsPlayer().performGraphic(ammo.getStartGraphic()); + } } } @@ -108,4 +134,4 @@ public void handleAfterHitEffects(QueueableHit hit) { } -} +} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/pvp/BountyHunter.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/pvp/BountyHunter.java index eaef634..493c224 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/pvp/BountyHunter.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/pvp/BountyHunter.java @@ -6,7 +6,6 @@ import com.elvarg.net.SessionState; import com.elvarg.util.Misc; import com.elvarg.util.Stopwatch; -import com.elvarg.world.content.ServerFeed; import com.elvarg.world.entity.combat.CombatFactory; import com.elvarg.world.entity.impl.player.Player; import com.elvarg.world.grounditems.GroundItemManager; @@ -281,10 +280,6 @@ public void killedPlayer(Player killed) { } else player.getBountyHunter().incrementKills(); - ServerFeed.submit("@whi@[@gre@" + Misc.getCurrentServerTime() - + "@whi@] @or1@" + player.getUsername() + " @whi@has defeated @yel@" + killed.getUsername() + "@whi@!", - 15); - killed.getBountyHunter().incrementDeaths(); killed.getBountyHunter().updateInterface(); } diff --git a/Elvarg - Server/src/com/elvarg/world/entity/combat/ranged/RangedData.java b/Elvarg - Server/src/com/elvarg/world/entity/combat/ranged/RangedData.java index 1c5b285..6635051 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/combat/ranged/RangedData.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/combat/ranged/RangedData.java @@ -4,7 +4,6 @@ import java.util.Map; import com.elvarg.cache.impl.definitions.WeaponInterfaces; -import com.elvarg.cache.impl.definitions.WeaponInterfaces.WeaponInterface; import com.elvarg.engine.task.impl.CombatPoisonEffect.PoisonType; import com.elvarg.util.Misc; import com.elvarg.world.entity.combat.CombatFactory; @@ -255,44 +254,30 @@ public enum RangedWeaponData { new AmmunitionData[] { AmmunitionData.RUNE_KNIFE }, RangedWeaponType.THROW), - BRONZE_THROWNAXE(new int[] { 800 }, new AmmunitionData[] { AmmunitionData.BRONZE_THROWNAXE }, - RangedWeaponType.THROW), IRON_THROWNAXE(new int[] { 801 }, - new AmmunitionData[] { AmmunitionData.IRON_THROWNAXE }, - RangedWeaponType.THROW), STEEL_THROWNAXE(new int[] { 802 }, - new AmmunitionData[] { AmmunitionData.STEEL_THROWNAXE }, - RangedWeaponType.THROW), MITHRIL_THROWNAXE(new int[] { 803 }, - new AmmunitionData[] { AmmunitionData.MITHRIL_THROWNAXE }, - RangedWeaponType.THROW), ADAMANT_THROWNAXE(new int[] { 804 }, - new AmmunitionData[] { AmmunitionData.ADAMANT_THROWNAXE }, - RangedWeaponType.THROW), RUNE_THROWNAXE(new int[] { 805 }, - new AmmunitionData[] { AmmunitionData.RUNE_THROWNAXE }, - RangedWeaponType.THROW), + /* + * BRONZE_THROWNAXE(new int[] {800}, new AmmunitionData[] + * {AmmunitionData.BRONZE_THROWNAXE}, RangedWeaponType.THROW), + * IRON_THROWNAXE(new int[] {801}, new AmmunitionData[] + * {AmmunitionData.IRON_THROWNAXE}, RangedWeaponType.THROW), + * STEEL_THROWNAXE(new int[] {802}, new AmmunitionData[] + * {AmmunitionData.STEEL_THROWNAXE}, RangedWeaponType.THROW), + * MITHRIL_THROWNAXE(new int[] {803}, new AmmunitionData[] + * {AmmunitionData.MITHRIL_THROWNAXE}, RangedWeaponType.THROW), + * ADAMANT_THROWNAXE(new int[] {804}, new AmmunitionData[] + * {AmmunitionData.ADAMANT_THROWNAXE}, RangedWeaponType.THROW), + * RUNE_THROWNAXE(new int[] {805}, new AmmunitionData[] + * {AmmunitionData.RUNE_THROWNAXE}, RangedWeaponType.THROW), + */ TOKTZ_XIL_UL(new int[] { 6522 }, new AmmunitionData[] { AmmunitionData.TOKTZ_XIL_UL }, RangedWeaponType.THROW), - BRONZE_JAVELIN(new int[] { 825 }, new AmmunitionData[] { AmmunitionData.BRONZE_JAVELIN }, - RangedWeaponType.THROW), IRON_JAVELIN(new int[] { 826 }, - new AmmunitionData[] { AmmunitionData.IRON_JAVELIN }, RangedWeaponType.THROW), STEEL_JAVELIN( - new int[] { 827 }, new AmmunitionData[] { AmmunitionData.STEEL_JAVELIN }, - RangedWeaponType.THROW), MITHRIL_JAVELIN(new int[] { 828 }, - new AmmunitionData[] { AmmunitionData.MITHRIL_JAVELIN }, - RangedWeaponType.THROW), ADAMANT_JAVELIN(new int[] { 829 }, - new AmmunitionData[] { AmmunitionData.ADAMANT_JAVELIN }, - RangedWeaponType.THROW), RUNE_JAVELIN(new int[] { 830 }, - new AmmunitionData[] { AmmunitionData.RUNE_JAVELIN }, - RangedWeaponType.THROW), - - CHINCHOMPA(new int[] { 10033 }, new AmmunitionData[] { AmmunitionData.CHINCHOMPA }, - RangedWeaponType.THROW), RED_CHINCHOMPA(new int[] { 10034 }, - new AmmunitionData[] { AmmunitionData.RED_CHINCHOMPA }, RangedWeaponType.THROW), - KARILS_CROSSBOW(new int[] { 4734 }, new AmmunitionData[] { AmmunitionData.BOLT_RACK }, RangedWeaponType.CROSSBOW), BALLISTA(new int[] { 19478, 19481 }, new AmmunitionData[] { AmmunitionData.BRONZE_JAVELIN, AmmunitionData.IRON_JAVELIN, AmmunitionData.STEEL_JAVELIN, AmmunitionData.MITHRIL_JAVELIN, AmmunitionData.ADAMANT_JAVELIN, - AmmunitionData.RUNE_JAVELIN }, + AmmunitionData.RUNE_JAVELIN, AmmunitionData.DRAGON_JAVELIN }, RangedWeaponType.BALLISTA), TOXIC_BLOWPIPE(new int[] { 12926 }, new AmmunitionData[] { AmmunitionData.ZULRAH_SCALES }, RangedWeaponType.BLOWPIPE); @@ -334,209 +319,211 @@ public static RangedWeaponData getFor(Player p) { public enum AmmunitionData { - BRONZE_ARROW(882, 19, 10, 3, 44, 7, 43, 31), IRON_ARROW(884, 18, 9, 3, 44, 10, 43, 31), STEEL_ARROW(886, 20, 11, - 3, 44, 16, 43, 31), MITHRIL_ARROW(888, 21, 12, 3, 44, 22, 43, 31), ADAMANT_ARROW(890, 22, 13, 3, 44, 31, - 43, 31), RUNE_ARROW(892, 24, 15, 3, 44, 50, 43, 31), ICE_ARROW(78, 25, 16, 3, 44, 58, 34, - 31), BROAD_ARROW(4160, 20, 11, 3, 44, 58, 43, - 31), DRAGON_ARROW(11212, 1111, 1120, 3, 44, 65, 43, 31), - - BRONZE_BOLT(877, -1, 27, 3, 44, 13, 43, 31), OPAL_BOLT(879, -1, 27, 3, 44, 20, 43, 31), ENCHANTED_OPAL_BOLT( - 9236, -1, 27, 3, 44, 20, 43, 31), IRON_BOLT(9140, -1, 27, 3, 44, 28, 43, 31), JADE_BOLT(9335, -1, 27, 3, - 44, 31, 43, 31), ENCHANTED_JADE_BOLT(9237, -1, 27, 3, 44, 31, 43, 31), STEEL_BOLT(9141, -1, 27, - 3, 44, 35, 43, 31), PEARL_BOLT(880, -1, 27, 3, 44, 38, 43, 31), ENCHANTED_PEARL_BOLT( - 9238, -1, 27, 3, 44, 38, 43, 31), MITHRIL_BOLT(9142, -1, 27, 3, 44, 40, 43, - 31), TOPAZ_BOLT(9336, -1, 27, 3, 44, 50, 43, 31), ENCHANTED_TOPAZ_BOLT( - 9239, -1, 27, 3, 44, 50, 43, 31), ADAMANT_BOLT(9143, -1, 27, 3, - 44, 60, 43, 31), SAPPHIRE_BOLT(9337, -1, 27, 3, 44, 65, - 43, 31), ENCHANTED_SAPPHIRE_BOLT(9240, -1, 27, - 3, 44, 65, 43, 31), EMERALD_BOLT(9338, - -1, 27, 3, 44, 70, 43, - 31), ENCHANTED_EMERALD_BOLT( - 9241, -1, 27, 3, 44, 70, - 43, 31), RUBY_BOLT(9339, - -1, 27, 3, 44, - 75, 43, - 31), ENCHANTED_RUBY_BOLT( - 9242, - -1, 27, - 3, 44, - 75, 43, - 31), RUNITE_BOLT( - 9144, - -1, + BRONZE_ARROW(882, new Graphic(19, GraphicHeight.HIGH), 10, 7), IRON_ARROW(884, + new Graphic(18, GraphicHeight.HIGH), 9, 10), STEEL_ARROW(886, new Graphic(20, GraphicHeight.HIGH), 11, + 16), MITHRIL_ARROW(888, new Graphic(21, GraphicHeight.HIGH), 12, 22), ADAMANT_ARROW(890, + new Graphic(22, GraphicHeight.HIGH), 13, + 31), RUNE_ARROW(892, new Graphic(24, GraphicHeight.HIGH), 15, 50), ICE_ARROW(78, + new Graphic(25, GraphicHeight.HIGH), 16, 58), BROAD_ARROW(4160, + new Graphic(20, GraphicHeight.HIGH), 11, 58), DRAGON_ARROW(11212, + new Graphic(1111, GraphicHeight.HIGH), 1120, 65), + + BRONZE_BOLT(877, new Graphic(955, GraphicHeight.HIGH), 27, 13), OPAL_BOLT(879, + new Graphic(955, GraphicHeight.HIGH), 27, + 20), ENCHANTED_OPAL_BOLT(9236, new Graphic(955, GraphicHeight.HIGH), 27, 20), IRON_BOLT(9140, + new Graphic(955, GraphicHeight.HIGH), 27, + 28), JADE_BOLT(9335, new Graphic(955, GraphicHeight.HIGH), 27, 31), ENCHANTED_JADE_BOLT(9237, + new Graphic(955, GraphicHeight.HIGH), 27, + 31), STEEL_BOLT(9141, new Graphic(955, GraphicHeight.HIGH), 27, 35), PEARL_BOLT(880, + new Graphic(955, GraphicHeight.HIGH), 27, 38), ENCHANTED_PEARL_BOLT(9238, + new Graphic(955, GraphicHeight.HIGH), 27, 38), MITHRIL_BOLT(9142, + new Graphic(955, GraphicHeight.HIGH), 27, 40), TOPAZ_BOLT(9336, + new Graphic(955, GraphicHeight.HIGH), 27, + 50), ENCHANTED_TOPAZ_BOLT(9239, + new Graphic(955, GraphicHeight.HIGH), 27, + 50), ADAMANT_BOLT(9143, + new Graphic(955, GraphicHeight.HIGH), + 27, 60), SAPPHIRE_BOLT(9337, + new Graphic(955, + GraphicHeight.HIGH), + 27, + 65), ENCHANTED_SAPPHIRE_BOLT( + 9240, + new Graphic(955, + GraphicHeight.HIGH), + 27, + 65), EMERALD_BOLT(9338, + new Graphic(955, + GraphicHeight.HIGH), + 27, + 70), ENCHANTED_EMERALD_BOLT( + 9241, + new Graphic( + 955, + GraphicHeight.HIGH), + 27, + 70), RUBY_BOLT( + 9339, + new Graphic( + 955, + GraphicHeight.HIGH), 27, - 3, - 44, - 84, - 43, - 31), BROAD_BOLT( - 13280, - -1, + 75), ENCHANTED_RUBY_BOLT( + 9242, + new Graphic( + 955, + GraphicHeight.HIGH), 27, - 3, - 44, - 88, - 43, - 31), DIAMOND_BOLT( - 9340, - -1, + 75), BROAD_BOLT( + 13280, + new Graphic( + 955, + GraphicHeight.HIGH), 27, - 3, - 44, - 88, - 43, - 31), ENCHANTED_DIAMOND_BOLT( - 9243, - -1, + 100), RUNITE_BOLT( + 9144, + new Graphic( + 955, + GraphicHeight.HIGH), 27, - 3, - 44, - 88, - 43, - 31), ONYX_BOLT( - 9342, - -1, + 115), DIAMOND_BOLT( + 9340, + new Graphic( + 955, + GraphicHeight.HIGH), 27, - 3, - 44, - 90, - 43, - 31), ENCHANTED_ONYX_BOLT( - 9245, - -1, + 105), ENCHANTED_DIAMOND_BOLT( + 9243, + new Graphic( + 955, + GraphicHeight.HIGH), 27, - 3, - 44, - 90, - 43, - 31), DRAGON_BOLT( + 105), DRAGON_BOLT( 9341, - -1, + new Graphic( + 955, + GraphicHeight.HIGH), 27, - 3, - 44, - 90, - 43, - 31), ENCHANTED_DRAGON_BOLT( + 117), ENCHANTED_DRAGON_BOLT( 9244, - -1, + new Graphic( + 955, + GraphicHeight.HIGH), 27, - 3, - 44, - 90, - 43, - 31), - - BRONZE_DART(806, 1234, 226, 4, 33, 2, 45, 37), IRON_DART(807, 1235, 227, 4, 33, 5, 45, 37), STEEL_DART(808, - 1236, 228, 4, 33, 8, 45, 37), MITHRIL_DART(809, 1238, 229, 4, 33, 10, 45, 37), ADAMANT_DART(810, 1239, - 230, 4, 33, 15, 45, 37), RUNE_DART(811, 1240, 231, 4, 33, 20, 45, - 37), DRAGON_DART(11230, 1123, 226, 4, 33, 25, 49, 37), - - BRONZE_KNIFE(864, 219, 212, 4, 33, 8, 45, 37), BRONZE_KNIFE_P1(870, 219, 212, 4, 33, 8, 45, - 37), BRONZE_KNIFE_P2(5654, 219, 212, 4, 33, 8, 45, - 37), BRONZE_KNIFE_P3(5661, 219, 212, 4, 33, 8, 45, 37), - - IRON_KNIFE(863, 220, 213, 4, 33, 12, 45, 37), IRON_KNIFE_P1(871, 220, 213, 4, 33, 12, 45, - 37), IRON_KNIFE_P2(5655, 220, 213, 4, 33, 12, 45, 37), IRON_KNIFE_P3(5662, 220, 213, 4, 33, 12, 45, 37), - - STEEL_KNIFE(865, 221, 214, 4, 33, 15, 45, 37), STEEL_KNIFE_P1(872, 221, 214, 4, 33, 15, 45, 37), STEEL_KNIFE_P2( - 5656, 221, 214, 4, 33, 15, 45, 37), STEEL_KNIFE_P3(5663, 221, 214, 4, 33, 15, 45, 37), - - BLACK_KNIFE(869, 222, 215, 4, 33, 17, 45, 37), BLACK_KNIFE_P1(874, 222, 215, 4, 33, 17, 45, 37), BLACK_KNIFE_P2( - 5658, 222, 215, 4, 33, 17, 45, 37), BLACK_KNIFE_P3(5665, 222, 215, 4, 33, 17, 45, 37), - - MITHRIL_KNIFE(866, 223, 215, 4, 33, 19, 45, 37), MITHRIL_KNIFE_P1(873, 223, 215, 4, 33, 19, 45, - 37), MITHRIL_KNIFE_P2(5657, 223, 215, 4, 33, 19, 45, - 37), MITHRIL_KNIFE_P3(5664, 223, 215, 4, 33, 19, 45, 37), - - ADAMANT_KNIFE(867, 224, 217, 4, 33, 24, 45, 37), ADAMANT_KNIFE_P1(875, 224, 217, 4, 33, 24, 45, - 37), ADAMANT_KNIFE_P2(5659, 224, 217, 4, 33, 24, 45, - 37), ADAMANT_KNIFE_P3(5666, 224, 217, 4, 33, 24, 45, 37), - - RUNE_KNIFE(868, 225, 218, 4, 33, 30, 48, 37), RUNE_KNIFE_P1(876, 225, 218, 4, 33, 30, 48, - 37), RUNE_KNIFE_P2(5660, 225, 218, 4, 33, 30, 48, 37), RUNE_KNIFE_P3(5667, 225, 218, 4, 33, 30, 48, 37), - - BRONZE_THROWNAXE(800, 43, 36, 3, 44, 7, 43, 31), IRON_THROWNAXE(801, 42, 35, 3, 44, 9, 43, 31), STEEL_THROWNAXE( - 802, 44, 37, 3, 44, 11, 43, 31), MITHRIL_THROWNAXE(803, 45, 38, 3, 44, 13, 43, 31), ADAMANT_THROWNAXE( - 804, 46, 39, 3, 44, 15, 43, 31), RUNE_THROWNAXE(805, 48, 41, 3, 44, 17, 43, 31), - - BRONZE_JAVELIN(825, 206, 200, 2, 40, 7, 45, 37), IRON_JAVELIN(826, 207, 201, 2, 40, 9, 45, 37), STEEL_JAVELIN( - 827, 208, 202, 2, 40, 11, 45, 37), MITHRIL_JAVELIN(828, 209, 203, 2, 40, 13, 45, 37), ADAMANT_JAVELIN( - 829, 210, 204, 2, 40, 15, 45, 37), RUNE_JAVELIN(830, 211, 205, 2, 40, 17, 45, 37), - - TOKTZ_XIL_UL(6522, -1, 442, 2, 40, 58, 51, 37), - - CHINCHOMPA(10033, -1, -1, 17, 8, 50, 45, 37), RED_CHINCHOMPA(10034, -1, -1, 17, 8, 80, 45, 37), - - BOLT_RACK(4740, -1, 27, 3, 33, 70, 43, 31), - - ZULRAH_SCALES(12934, -1, 27, 3, 33, 115, 43, 31); + 117), ONYX_BOLT( + 9342, + new Graphic( + 955, + GraphicHeight.HIGH), + 27, + 120), ENCHANTED_ONYX_BOLT( + 9245, + new Graphic( + 955, + GraphicHeight.HIGH), + 27, + 120), + + BRONZE_DART(806, new Graphic(232, GraphicHeight.HIGH), 226, 2), IRON_DART(807, + new Graphic(233, GraphicHeight.HIGH), 227, 5), STEEL_DART(808, new Graphic(234, GraphicHeight.HIGH), + 228, 8), MITHRIL_DART(809, new Graphic(235, GraphicHeight.HIGH), 229, 10), ADAMANT_DART(810, + new Graphic(236, GraphicHeight.HIGH), 230, 15), RUNE_DART(811, + new Graphic(237, GraphicHeight.HIGH), 231, + 20), DRAGON_DART(11230, new Graphic(1123, GraphicHeight.HIGH), 226, 25), + + BRONZE_KNIFE(864, new Graphic(219, GraphicHeight.HIGH), 212, 8), BRONZE_KNIFE_P1(870, + new Graphic(219, GraphicHeight.HIGH), 212, 8), BRONZE_KNIFE_P2(5654, + new Graphic(219, GraphicHeight.HIGH), 212, + 8), BRONZE_KNIFE_P3(5661, new Graphic(219, GraphicHeight.HIGH), 212, 8), + + IRON_KNIFE(863, new Graphic(220, GraphicHeight.HIGH), 213, 12), IRON_KNIFE_P1(871, + new Graphic(220, GraphicHeight.HIGH), 213, 12), IRON_KNIFE_P2(5655, + new Graphic(220, GraphicHeight.HIGH), 213, + 12), IRON_KNIFE_P3(5662, new Graphic(220, GraphicHeight.HIGH), 213, 12), + + STEEL_KNIFE(865, new Graphic(221, GraphicHeight.HIGH), 214, 15), STEEL_KNIFE_P1(872, + new Graphic(221, GraphicHeight.HIGH), 214, 15), STEEL_KNIFE_P2(5656, + new Graphic(221, GraphicHeight.HIGH), 214, + 15), STEEL_KNIFE_P3(5663, new Graphic(221, GraphicHeight.HIGH), 214, 15), + + BLACK_KNIFE(869, new Graphic(222, GraphicHeight.HIGH), 215, 17), BLACK_KNIFE_P1(874, + new Graphic(222, GraphicHeight.HIGH), 215, 17), BLACK_KNIFE_P2(5658, + new Graphic(222, GraphicHeight.HIGH), 215, + 17), BLACK_KNIFE_P3(5665, new Graphic(222, GraphicHeight.HIGH), 215, 17), + + MITHRIL_KNIFE(866, new Graphic(223, GraphicHeight.HIGH), 215, 19), MITHRIL_KNIFE_P1(873, + new Graphic(223, GraphicHeight.HIGH), 215, 19), MITHRIL_KNIFE_P2(5657, + new Graphic(223, GraphicHeight.HIGH), 215, + 19), MITHRIL_KNIFE_P3(5664, new Graphic(223, GraphicHeight.HIGH), 215, 19), + + ADAMANT_KNIFE(867, new Graphic(224, GraphicHeight.HIGH), 217, 24), ADAMANT_KNIFE_P1(875, + new Graphic(224, GraphicHeight.HIGH), 217, 24), ADAMANT_KNIFE_P2(5659, + new Graphic(224, GraphicHeight.HIGH), 217, + 24), ADAMANT_KNIFE_P3(5666, new Graphic(224, GraphicHeight.HIGH), 217, 24), + + RUNE_KNIFE(868, new Graphic(225, GraphicHeight.HIGH), 218, 30), RUNE_KNIFE_P1(876, + new Graphic(225, GraphicHeight.HIGH), 218, + 30), RUNE_KNIFE_P2(5660, new Graphic(225, GraphicHeight.HIGH), 218, + 30), RUNE_KNIFE_P3(5667, new Graphic(225, GraphicHeight.HIGH), 218, 30), + + /* + * BRONZE_THROWNAXE(800, 43, 36, 3, 44, 7), IRON_THROWNAXE(801, 42, 35, + * 3, 44, 9), STEEL_THROWNAXE(802, 44, 37, 3, 44, 11), + * MITHRIL_THROWNAXE(803, 45, 38, 3, 44, 13), ADAMANT_THROWNAXE(804, 46, + * 39, 3, 44, 15), RUNE_THROWNAXE(805, 48, 41, 3, 44, 17), + */ + + BRONZE_JAVELIN(825, null, 200, 25), IRON_JAVELIN(826, null, 201, 42), STEEL_JAVELIN(827, null, 202, + 64), MITHRIL_JAVELIN(828, null, 203, 85), ADAMANT_JAVELIN(829, null, 204, + 107), RUNE_JAVELIN(830, null, 205, 124), DRAGON_JAVELIN(19484, null, 1301, 150), + + TOKTZ_XIL_UL(6522, null, 442, 58), + + BOLT_RACK(4740, null, 27, 55), + + ZULRAH_SCALES(12934, null, 27, 115); ; - AmmunitionData(int itemId, int startGfxId, int projectileId, int projectileSpeed, int projectileDelay, - int strength, int startHeight, int endHeight) { + AmmunitionData(int itemId, Graphic startGfx, int projectileId, int strength) { this.itemId = itemId; - this.startGfxId = startGfxId; + this.startGfx = startGfx; this.projectileId = projectileId; - this.projectileSpeed = projectileSpeed; - this.projectileDelay = projectileDelay; this.strength = strength; - this.startHeight = startHeight; - this.endHeight = endHeight; } private int itemId; - private int startGfxId; + private final Graphic startGfx; private int projectileId; - private int projectileSpeed; - private int projectileDelay; private int strength; - private int startHeight; - private int endHeight; public int getItemId() { return itemId; } - public int getStartGfxId() { - return startGfxId; + public Graphic getStartGraphic() { + return startGfx; } public int getProjectileId() { return projectileId; } - public int getProjectileSpeed() { - return projectileSpeed; - } - - public int getProjectileDelay() { - return projectileDelay; - } - public int getStrength() { return strength; } - public int getStartHeight() { - return startHeight; - } - - public int getEndHeight() { - return endHeight; - } - public static AmmunitionData getFor(Player p) { - AmmunitionData arrows = range_ammo_data.get(p.getEquipment().getItems()[Equipment.AMMUNITION_SLOT].getId()); - if (arrows == null) { - - // Player has no arrows. - // Maybe they have a throw weapon though? Knife/dart/javelin - return range_ammo_data.get(p.getEquipment().getItems()[Equipment.WEAPON_SLOT].getId()); + // First try to get a throw weapon as ammo + AmmunitionData throwWeapon = range_ammo_data + .get(p.getEquipment().getItems()[Equipment.WEAPON_SLOT].getId()); + // Didnt find one. Try arrows + if (throwWeapon == null) { + return range_ammo_data.get(p.getEquipment().getItems()[Equipment.AMMUNITION_SLOT].getId()); } - return arrows; + + return throwWeapon; } static { @@ -548,23 +535,19 @@ public static AmmunitionData getFor(Player p) { public enum RangedWeaponType { - LONGBOW(5, 5), SHORTBOW(5, 4), CROSSBOW(5, 5), THROW(4, 3), DARK_BOW(5, 5), BALLISTA(5, 6), BLOWPIPE(5, 3); + THROW(4), + + LONGBOW(5), SHORTBOW(5), CROSSBOW(5), DARK_BOW(5), BALLISTA(5), BLOWPIPE(5); - RangedWeaponType(int distanceRequired, int attackDelay) { + RangedWeaponType(int distanceRequired) { this.distanceRequired = distanceRequired; - this.attackDelay = attackDelay; } private int distanceRequired; - private int attackDelay; public int getDistanceRequired() { return distanceRequired; } - - public int getAttackDelay() { - return attackDelay; - } } /** @@ -598,7 +581,7 @@ public static boolean checkAmmo(Player player) { // Get the ranged ammo data final AmmunitionData ammoData = player.getCombat().getAmmunition(); if (ammoData == null) { - player.getPacketSender().sendMessage("You don't have any arrows to fire."); + player.getPacketSender().sendMessage("You don't have any ammunition to fire."); player.getCombat().reset(); return false; } @@ -656,15 +639,17 @@ public static boolean checkAmmo(Player player) { public static void decrementAmmo(Player player, Position pos) { // Determine which slot we are decrementing ammo from. - int slot = player.getCombat().getWeapon() == WeaponInterface.SHORTBOW - || player.getCombat().getWeapon() == WeaponInterface.LONGBOW - || player.getCombat().getWeapon() == WeaponInterface.CROSSBOW ? Equipment.AMMUNITION_SLOT - : Equipment.WEAPON_SLOT; + int slot = Equipment.AMMUNITION_SLOT; - boolean accumalator = player.getEquipment().get(Equipment.CAPE_SLOT).getId() == 10499; + // Is the weapon using a throw weapon? + // The ammo should be dropped from the weapon slot. + if (player.getCombat().getRangedWeaponData().getType() == RangedWeaponType.THROW) { + slot = Equipment.WEAPON_SLOT; + } + boolean accumalator = player.getEquipment().get(Equipment.CAPE_SLOT).getId() == 10499; if (accumalator) { - if (Misc.getRandom(11) <= 9) { + if (Misc.getRandom(12) <= 9) { return; } } @@ -682,10 +667,10 @@ public static void decrementAmmo(Player player, Position pos) { player.getEquipment().set(slot, new Item(-1)); if (slot == Equipment.WEAPON_SLOT) { + RangedData.updateDataFor(player); WeaponInterfaces.assign(player); player.getUpdateFlag().flag(Flag.APPEARANCE); } - } // Refresh the equipment interface. @@ -808,4 +793,4 @@ public static double getSpecialEffectsMultiplier(Player p, Character target, int return multiplier; } -} +} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/NpcAggression.java b/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/NpcAggression.java index e51d8c3..e92ff59 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/NpcAggression.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/NpcAggression.java @@ -21,67 +21,49 @@ public final class NpcAggression { public static final int NPC_TOLERANCE_SECONDS = 300; // 5 mins public static void target(Player player) { - if (CombatFactory.inCombat(player) && !Location.inMulti(player)) { return; } - // Loop through all of the aggressive npcs. for (NPC npc : player.getLocalNpcs()) { - if (npc == null || npc.getHitpoints() <= 0) { continue; } - - // NPCFacing.updateFacing(player, npc); - if (npc.getDefinition().getAggressionDistance() <= 0) { continue; } - - // if(!npc.findNewTarget()) { if (CombatFactory.inCombat(npc)) { continue; } - // } - boolean bandits = npc.getId() == 690; - if (!bandits) { if (player.getTolerance().elapsed() > (NPC_TOLERANCE_SECONDS * 1000)) { break; } - if (player.getSkillManager().getCombatLevel() > (npc.getDefinition().getCombatLevel() * 2) && player.getLocation() != Location.WILDERNESS) { continue; } } - int distance = npc.getSpawnPosition().getDistance(player.getPosition()); if (distance < npc.getDefinition().getAggressionDistance() && distance < npc.getDefinition().getCombatFollowDistance()) { if (CombatFactory.canAttack(npc, CombatFactory.getMethod(npc), player)) { - - // Bandits if (bandits) { int zammy = Equipment.getItemCount(player, "Zamorak", true); int sara = Equipment.getItemCount(player, "Saradomin", true); - if (!(zammy > 0 || sara > 0)) { continue; } - if (Misc.getRandom(2) == 1) { - String s = zammy > 0 ? "Zamorak" : "Saradomin"; - if (Misc.getRandom(2) == 1) { - npc.forceChat("Filthy " + s + " follower scum!"); - } else { - npc.forceChat("" + s + " scum! You will regret coming here!"); + String s = zammy > 0 ? "Zamorakian" : "Saradominist"; + if (s.equals("Zamorakian")) { + npc.forceChat("Prepare to suffer, " + s + " scum!"); + } else if (s.equals("Saradominist")) { + npc.forceChat("Time to die, " + s + " filth!"); } } } - npc.getCombat().attack(player); break; } diff --git a/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/MobCombatHandler.java b/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/MobCombatHandler.java index c31ba83..10b6290 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/MobCombatHandler.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/MobCombatHandler.java @@ -4,7 +4,7 @@ import java.util.List; import com.elvarg.world.entity.impl.npc.NPC; -import com.elvarg.world.entity.impl.npc.combat.impl.Goblin; +import com.elvarg.world.entity.impl.npc.combat.impl.Bandit; import com.elvarg.world.entity.impl.player.Player; public class MobCombatHandler { @@ -14,7 +14,7 @@ public class MobCombatHandler { private static final List mob_list = new ArrayList<>(); static { - mob_list.add(new Goblin()); + mob_list.add(new Bandit()); } public int getAttackAnimation(int id) { diff --git a/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/impl/Goblin.java b/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/impl/Bandit.java similarity index 92% rename from Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/impl/Goblin.java rename to Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/impl/Bandit.java index 8f7e931..86e5d16 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/impl/Goblin.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/impl/npc/combat/impl/Bandit.java @@ -4,7 +4,7 @@ import com.elvarg.world.entity.impl.npc.combat.MobCombatHandler; import com.elvarg.world.entity.impl.npc.combat.SpecialMob; -public class Goblin implements SpecialMob { +public class Bandit implements SpecialMob { @Override public int getAttackAnimation() { @@ -27,7 +27,7 @@ public int getDeathAnimation() { @Override public int getMaxHit() { // TODO Auto-generated method stub - return 0; + return 13; } @Override diff --git a/Elvarg - Server/src/com/elvarg/world/entity/impl/player/Player.java b/Elvarg - Server/src/com/elvarg/world/entity/impl/player/Player.java index 07f9dfd..116f1b7 100644 --- a/Elvarg - Server/src/com/elvarg/world/entity/impl/player/Player.java +++ b/Elvarg - Server/src/com/elvarg/world/entity/impl/player/Player.java @@ -19,12 +19,12 @@ import com.elvarg.util.FrameUpdater; import com.elvarg.util.Stopwatch; import com.elvarg.world.World; -import com.elvarg.world.content.PrayerHandler; -import com.elvarg.world.content.ServerFeed; import com.elvarg.world.content.Trading; import com.elvarg.world.content.clan.ClanChat; import com.elvarg.world.content.clan.ClanChatManager; import com.elvarg.world.content.skills.SkillManager; +import com.elvarg.world.content.skills.herblore.HerbSack; +import com.elvarg.world.content.skills.prayer.PrayerHandler; import com.elvarg.world.entity.combat.CombatFactory; import com.elvarg.world.entity.combat.CombatSpecial; import com.elvarg.world.entity.combat.CombatType; @@ -37,9 +37,9 @@ import com.elvarg.world.model.Animation; import com.elvarg.world.model.Appearance; import com.elvarg.world.model.ChatMessage; -import com.elvarg.world.model.EffectTimer; import com.elvarg.world.model.Flag; import com.elvarg.world.model.ForceMovement; +import com.elvarg.world.model.Item; import com.elvarg.world.model.Locations; import com.elvarg.world.model.MagicSpellbook; import com.elvarg.world.model.PlayerInteractingOption; @@ -87,9 +87,10 @@ public int getAttackAnim() { @Override public int getBlockAnim() { - ItemDefinition def = getEquipment().getItems()[Equipment.WEAPON_SLOT].getDefinition(); - int anim = def.getBlockAnim(); - return anim; + final Item shield = getEquipment().getItems()[Equipment.SHIELD_SLOT]; + final Item weapon = getEquipment().getItems()[Equipment.WEAPON_SLOT]; + ItemDefinition definition = shield.getId() > 0 ? shield.getDefinition() : weapon.getDefinition(); + return definition.getBlockAnim(); } @Override @@ -97,11 +98,11 @@ public Character setHitpoints(int hitpoints) { if (isDying) { return this; } - skillManager.setCurrentLevel(Skill.HITPOINTS, hitpoints); packetSender.sendSkill(Skill.HITPOINTS); - if (getHitpoints() <= 0 && !isDying) + if (getHitpoints() <= 0 && !isDying) { appendDeath(); + } return this; } @@ -140,7 +141,6 @@ public int getBaseAttackSpeed() { if (getCombat().getFightType().toString().toLowerCase().contains("rapid")) { speed--; } - return speed; } @@ -185,11 +185,6 @@ public void onTick() { // Process locations Locations.process(this); - // Kill feed - if (getWalkableInterfaceId() == -1) { - getPacketSender().sendWalkableInterface(ServerFeed.INTERFACE_ID); - } - // More timers... if (getAndDecrementSkullTimer() == 0) { getUpdateFlag().flag(Flag.APPEARANCE); @@ -282,7 +277,7 @@ public void onLogin() { getSession().setState(SessionState.LOGGED_IN); // GRANT FULL PERMISSIONS WHILST SERVER BEING DEVELOPED - // setRights(PlayerRights.ADMINISTRATOR); + setRights(PlayerRights.ADMINISTRATOR); // Packets getPacketSender().sendMapRegion(); @@ -290,8 +285,6 @@ public void onLogin() { // Skills for (Skill skill : Skill.values()) { - // getSkillManager().setCurrentLevel(skill, 95).setMaxLevel(skill, - // 95).setExperience(skill, SkillManager.getExperienceForLevel(95)); getSkillManager().updateSkill(skill); } @@ -328,7 +321,7 @@ public void onLogin() { // Update weapon interface configs getPacketSender().sendConfig(getCombat().getFightType().getParentId(), getCombat().getFightType().getChildId()) - .sendConfig(172, getCombat().autoRetaliate() ? 1 : 0).updateSpecialAttackOrb(); + .sendConfig(172, getCombat().autoRetaliate() ? 1 : 0); // Reset autocasting Autocasting.setAutocast(this, null); @@ -339,9 +332,6 @@ public void onLogin() { // Update locations.. Locations.login(this); - // Update killfeed - ServerFeed.updateInterface(this); - // Join clanchat ClanChatManager.onLogin(this); @@ -352,38 +342,24 @@ public void onLogin() { if (getSpecialPercentage() < 100) { TaskManager.submit(new PlayerSpecialAmountTask(this)); } - - if (!getCombat().getFreezeTimer().finished()) { - getPacketSender().sendEffectTimer(getCombat().getFreezeTimer().secondsRemaining(), EffectTimer.FREEZE); - } - if (!getVengeanceTimer().finished()) { - getPacketSender().sendEffectTimer(getVengeanceTimer().secondsRemaining(), EffectTimer.VENGEANCE); - } if (!getOverloadTimer().finished()) { TaskManager.submit(new OverloadPotionTask(this)); - getPacketSender().sendEffectTimer(getOverloadTimer().secondsRemaining(), EffectTimer.OVERLOAD); } - if (!getCombat().getFireImmunityTimer().finished()) { - getPacketSender().sendEffectTimer(getCombat().getFireImmunityTimer().secondsRemaining(), - EffectTimer.ANTIFIRE); - } - if (!getCombat().getTeleBlockTimer().finished()) { - getPacketSender().sendEffectTimer(getCombat().getTeleBlockTimer().secondsRemaining(), - EffectTimer.TELE_BLOCK); - } - - getUpdateFlag().flag(Flag.APPEARANCE); - // Add items if new plr if (isNewPlayer()) { - for (int[] item : GameConstants.startKit) { - getInventory().add((item[0]), item[1]); - } - getPacketSender().sendMessage("Available commands: ").sendMessage("").sendMessage("::item id amount") - .sendMessage("::setlevel skillId level").sendMessage("::master").sendMessage("::runes"); - + GameConstants.STATER_KIT_INVENTORY.forEach(this.getInventory()::add); + this.getEquipment().setItem(Equipment.AMULET_SLOT, new Item(1712, 1)); + this.getEquipment().setItem(Equipment.HANDS_SLOT, new Item(11118, 1)); + this.getEquipment().setItem(Equipment.SHIELD_SLOT, new Item(3842, 1)); + this.getEquipment().setItem(Equipment.CAPE_SLOT, new Item(1007, 1)); + this.getEquipment().setItem(Equipment.FEET_SLOT, new Item(1837, 1)); + this.getEquipment().setItem(Equipment.LEG_SLOT, new Item(1067, 1)); + this.getEquipment().setItem(Equipment.BODY_SLOT, new Item(1115, 1)); + this.getEquipment().setItem(Equipment.WEAPON_SLOT, new Item(1323, 1)); + this.getEquipment().refreshItems(); + this.getInventory().refreshItems(); } - + getUpdateFlag().flag(Flag.APPEARANCE); // Add the player to register queue World.getPlayerAddQueue().add(this); } @@ -393,7 +369,6 @@ public void onLogin() { */ @Override public void onRegister() { - // Sends details about the player, such as their player index. getPacketSender().sendDetails(); } @@ -417,8 +392,9 @@ public void restart() { PrayerHandler.deactivatePrayers(this); getEquipment().refreshItems(); getInventory().refreshItems(); - for (Skill skill : Skill.values()) + for (Skill skill : Skill.values()) { getSkillManager().setCurrentLevel(skill, getSkillManager().getMaxLevel(skill)); + } setRunEnergy(100); getMovementQueue().setMovementStatus(MovementStatus.NONE).reset(); getUpdateFlag().flag(Flag.APPEARANCE); @@ -430,10 +406,6 @@ public boolean busy() { || getStatus() != PlayerStatus.NONE; } - /* - * Fields - */ - private DialogueOptions dialogueOptions; private String username; private String password; @@ -449,6 +421,7 @@ public boolean busy() { private final ChatMessage chatMessages = new ChatMessage(); private final FrameUpdater frameUpdater = new FrameUpdater(); private final BonusManager bonusManager = new BonusManager(); + private final HerbSack herbSack = new HerbSack(this); private PlayerSession session; private PlayerInteractingOption playerInteractingOption = PlayerInteractingOption.NONE; private PlayerRights rights = PlayerRights.PLAYER; @@ -682,6 +655,10 @@ public BonusManager getBonusManager() { return bonusManager; } + public HerbSack herbSack() { + return herbSack; + } + public int getMultiIcon() { return multiIcon; } diff --git a/Elvarg - Server/src/com/elvarg/world/model/Appearance.java b/Elvarg - Server/src/com/elvarg/world/model/Appearance.java index acb7867..665bb99 100644 --- a/Elvarg - Server/src/com/elvarg/world/model/Appearance.java +++ b/Elvarg - Server/src/com/elvarg/world/model/Appearance.java @@ -151,9 +151,9 @@ public void set() { if (isMale()) { look[HEAD] = 3; look[CHEST] = 18; - look[ARMS] = 26; - look[HANDS] = 34; - look[LEGS] = 38; + look[ARMS] = 30; + look[HANDS] = 33; + look[LEGS] = 39; look[FEET] = 42; look[BEARD] = 14; } else { @@ -165,9 +165,9 @@ public void set() { look[FEET] = 80; look[BEARD] = 57; } - look[HAIR_COLOUR] = 2; - look[TORSO_COLOUR] = 14; - look[LEG_COLOUR] = 5; + look[HAIR_COLOUR] = 7; + look[TORSO_COLOUR] = 1; + look[LEG_COLOUR] = 8; look[FEET_COLOUR] = 4; look[SKIN_COLOUR] = 0; player.getUpdateFlag().flag(Flag.APPEARANCE); diff --git a/Elvarg - Server/src/com/elvarg/world/model/DwarfCannon.java b/Elvarg - Server/src/com/elvarg/world/model/DwarfCannon.java deleted file mode 100644 index 206290f..0000000 --- a/Elvarg - Server/src/com/elvarg/world/model/DwarfCannon.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.elvarg.world.model; - -import com.elvarg.world.entity.impl.object.GameObject; - -/** - * @author Gabriel Hannason - */ - -public class DwarfCannon { - - public DwarfCannon(int ownerIndex, GameObject object) { - this.ownerIndex = ownerIndex; - this.object = object; - } - - private int ownerIndex; - private GameObject object; - private int cannonballs = 0; - private boolean cannonFiring = false; - private int rotations = 0; - - public int getOwnerIndex() { - return this.ownerIndex; - } - - public GameObject getObject() { - return this.object; - } - - public int getCannonballs() { - return this.cannonballs; - } - - public void setCannonballs(int cannonballs) { - this.cannonballs = cannonballs; - } - - public boolean cannonFiring() { - return this.cannonFiring; - } - - public void setCannonFiring(boolean firing) { - this.cannonFiring = firing; - } - - public int getRotations() { - return this.rotations; - } - - public void setRotations(int rotations) { - this.rotations = rotations; - } - - public void addRotation(int amount) { - this.rotations += amount; - } - -} diff --git a/Elvarg - Server/src/com/elvarg/world/model/EffectTimer.java b/Elvarg - Server/src/com/elvarg/world/model/EffectTimer.java deleted file mode 100644 index ed2e3f5..0000000 --- a/Elvarg - Server/src/com/elvarg/world/model/EffectTimer.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.elvarg.world.model; - -public enum EffectTimer { - - VENGEANCE(157), FREEZE(158), ANTIFIRE(159), OVERLOAD(160), TELE_BLOCK(161); - - EffectTimer(int clientSprite) { - this.clientSprite = clientSprite; - } - - public int getClientSprite() { - return clientSprite; - } - - public void setClientSprite(int sprite) { - this.clientSprite = sprite; - } - - private int clientSprite; -} diff --git a/Elvarg - Server/src/com/elvarg/world/model/Locations.java b/Elvarg - Server/src/com/elvarg/world/model/Locations.java index b99bde0..c47772e 100644 --- a/Elvarg - Server/src/com/elvarg/world/model/Locations.java +++ b/Elvarg - Server/src/com/elvarg/world/model/Locations.java @@ -100,19 +100,10 @@ public boolean canAttack(Player player, Player target) { } if (target.getLocation() != Location.WILDERNESS) { player.getPacketSender() - .sendMessage("That player cannot be attacked, because they are not in the Wilderness."); + .sendMessage("That player can't be attacked because they are not in the Wilderness."); player.getMovementQueue().reset(); return false; } - /* - * if(Misc.getMinutesPlayed(player) < 20) { - * player.getPacketSender(). - * sendMessage("You must have played for at least 20 minutes in order to attack someone." - * ); return false; } if(Misc.getMinutesPlayed(target) < 20) { - * player.getPacketSender(). - * sendMessage("This player is a new player and can therefore not be attacked yet." - * ); return false; } - */ return true; } }, diff --git a/Elvarg - Server/src/com/elvarg/world/model/Projectile.java b/Elvarg - Server/src/com/elvarg/world/model/Projectile.java index f5d91b6..e0bc642 100644 --- a/Elvarg - Server/src/com/elvarg/world/model/Projectile.java +++ b/Elvarg - Server/src/com/elvarg/world/model/Projectile.java @@ -99,7 +99,7 @@ public Projectile(Position start, Position end, int lockon, int projectileId, in public Projectile(Entity source, Entity victim, int projectileId, int delay, int speed, int startHeight, int endHeight, int curve) { this(source.getPosition(), victim.getPosition(), - (victim.isPlayer() ? -victim.getIndex() - 1 : victim.getIndex() + 1), projectileId, delay, speed, + (victim.isPlayer() ? -victim.getIndex() - 1 : victim.getIndex() + 1), projectileId, speed, delay, startHeight, endHeight, curve); } @@ -220,4 +220,4 @@ public int getDelay() { public int getCurve() { return curve; } -} +} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/model/container/impl/Equipment.java b/Elvarg - Server/src/com/elvarg/world/model/container/impl/Equipment.java index 41b6743..d3afe9c 100644 --- a/Elvarg - Server/src/com/elvarg/world/model/container/impl/Equipment.java +++ b/Elvarg - Server/src/com/elvarg/world/model/container/impl/Equipment.java @@ -110,16 +110,6 @@ public Equipment full() { */ public static final int AMMUNITION_SLOT = 13; - public boolean wearingNexAmours() { - int head = getPlayer().getEquipment().getItems()[HEAD_SLOT].getId(); - int body = getPlayer().getEquipment().getItems()[BODY_SLOT].getId(); - int legs = getPlayer().getEquipment().getItems()[LEG_SLOT].getId(); - boolean torva = head == 14008 && body == 14009 && legs == 14010; - boolean pernix = head == 14011 && body == 14012 && legs == 14013; - boolean virtus = head == 14014 && body == 14015 && legs == 14016; - return torva || pernix || virtus; - } - public boolean wearingHalberd() { ItemDefinition def = ItemDefinition.forId(getPlayer().getEquipment().getItems()[Equipment.WEAPON_SLOT].getId()); return def != null && def.getName().toLowerCase().endsWith("halberd"); @@ -147,17 +137,21 @@ public boolean properEquipmentForWilderness() { public static int getItemCount(Player p, String s, boolean inventory) { int count = 0; for (Item t : p.getEquipment().getItems()) { - if (t == null || t.getId() < 1 || t.getAmount() < 1) + if (t == null || t.getId() < 1 || t.getAmount() < 1) { continue; - if (t.getDefinition().getName().toLowerCase().contains(s.toLowerCase())) + } + if (t.getDefinition().getName().toLowerCase().contains(s.toLowerCase())) { count++; + } } if (inventory) { for (Item t : p.getInventory().getItems()) { - if (t == null || t.getId() < 1 || t.getAmount() < 1) + if (t == null || t.getId() < 1 || t.getAmount() < 1) { continue; - if (t.getDefinition().getName().toLowerCase().contains(s.toLowerCase())) + } + if (t.getDefinition().getName().toLowerCase().contains(s.toLowerCase())) { count++; + } } } return count; diff --git a/Elvarg - Server/src/com/elvarg/world/model/teleportation/TeleportHandler.java b/Elvarg - Server/src/com/elvarg/world/model/teleportation/TeleportHandler.java index d480e38..797b6d6 100644 --- a/Elvarg - Server/src/com/elvarg/world/model/teleportation/TeleportHandler.java +++ b/Elvarg - Server/src/com/elvarg/world/model/teleportation/TeleportHandler.java @@ -3,7 +3,6 @@ import com.elvarg.engine.task.Task; import com.elvarg.engine.task.TaskManager; import com.elvarg.world.entity.impl.player.Player; -import com.elvarg.world.model.EffectTimer; import com.elvarg.world.model.Locations.Location; import com.elvarg.world.model.Position; import com.elvarg.world.model.movement.MovementStatus; @@ -66,10 +65,8 @@ public static boolean checkReqs(Player player, Position targetLocation) { return false; } else { player.getCombat().getTeleBlockTimer().stop(); - player.getPacketSender().sendEffectTimer(0, EffectTimer.TELE_BLOCK); } } - if (player.getMovementQueue().getMovementStatus() == MovementStatus.DISABLED || !player.getClickDelay().elapsed(4500)) { return false; diff --git a/Elvarg - Server/src/com/elvarg/world/model/teleportation/tabs/TabHandler.java b/Elvarg - Server/src/com/elvarg/world/model/teleportation/tabs/TabHandler.java deleted file mode 100644 index 80c6f16..0000000 --- a/Elvarg - Server/src/com/elvarg/world/model/teleportation/tabs/TabHandler.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.elvarg.world.model.teleportation.tabs; - -import java.util.Optional; - -import com.elvarg.world.entity.impl.player.Player; -import com.elvarg.world.model.Item; -import com.elvarg.world.model.teleportation.TeleportHandler; -import com.elvarg.world.model.teleportation.TeleportType; - -/** - * Handles the Teleport Tablet event processing - * - * @author Dennis - * - */ -public class TabHandler { - - /** - * Reaction method that handles the initial tablet functions if applicable. - * - * @param player - * @param tablet - */ - public static void onClick(Player player, Item tablet) { - final Optional tab = TabData.getTab(tablet); - - // Checks if the tab isn't present, if not perform nothing - if (!tab.isPresent()) { - return; - } - - // Teleport the player to the proper Teleport Tablet location - if (TeleportHandler.checkReqs(player, tab.get().location())) { - - TeleportHandler.teleport(player, tab.get().location(), TeleportType.TELE_TAB); - - // Removes the Teleport Tablet item from inventory - player.getInventory().delete(tab.get().getTab()); - - } - } -} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/model/teleportation/tabs/TeleportTablet.java b/Elvarg - Server/src/com/elvarg/world/model/teleportation/tabs/TeleportTablet.java new file mode 100644 index 0000000..1e4e2b5 --- /dev/null +++ b/Elvarg - Server/src/com/elvarg/world/model/teleportation/tabs/TeleportTablet.java @@ -0,0 +1,117 @@ +package com.elvarg.world.model.teleportation.tabs; + +import java.util.Collections; +import java.util.EnumSet; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; + +import com.elvarg.world.entity.impl.player.Player; +import com.elvarg.world.model.Item; +import com.elvarg.world.model.Position; +import com.elvarg.world.model.teleportation.TeleportHandler; +import com.elvarg.world.model.teleportation.TeleportType; + +/** + * Handles the Teleport Tablet event processing + * + * @author Dennis + * + */ +public enum TeleportTablet { + + HOME(new Item(1), new Position(3222, 3222, 0)), + + LUMBRIDGE(new Item(8008), new Position(3222, 3218, 0)), + + FALADOR(new Item(8009), new Position(2965, 3379, 0)), + + CAMELOT(new Item(8010), new Position(2757, 3477, 0)), + + ARDY(new Item(8011), new Position(2661, 3305, 0)), + + WATCH(new Item(8012), new Position(2549, 3112, 0)), + + VARROCK(new Item(8007), new Position(3213, 3424, 0)); + + /** + * The {@link Item} of the teleport tablet. + */ + private final Item tablet; + + /** + * Gets the {@link #tablet} and returns as its initial value. + * + * @return tabId + */ + public Item getTab() { + return tablet; + } + + /** + * The specified {@link Position} that the teleport tablet will send the + * {@link Player} upon interaction. + */ + private final Position location; + + /** + * Gets the {@link #Position} and returns as its initial value. + * + * @return location + */ + public Position location() { + return location; + } + + /** + * TabData constructor + * + * @param tablet + * @param location + */ + private TeleportTablet(final Item tablet, final Position location) { + this.tablet = tablet; + this.location = location; + } + + /** + * The {@value #tab_set} storing + */ + private static Set tab_set = Collections.unmodifiableSet(EnumSet.allOf(TabData.class)); + + /** + * Gets the teleport tablet from the {@value #tab_set} stream. + * + * @param tablet + * @return tablet + */ + public static Optional getTab(Item tablet) { + return tab_set.stream().filter(Objects::nonNull).filter(tabs -> tabs.getTab().getId() == tablet.getId()) + .findAny(); + } + + /** + * Reaction method that handles the initial tablet functions if applicable. + * + * @param player + * @param tablet + */ + public static void onClick(Player player, Item tablet) { + final Optional tab = TabData.getTab(tablet); + + // Checks if the tab isn't present, if not perform nothing + if (!tab.isPresent()) { + return; + } + + // Teleport the player to the proper Teleport Tablet location + if (TeleportHandler.checkReqs(player, tab.get().location())) { + + TeleportHandler.teleport(player, tab.get().location(), TeleportType.TELE_TAB); + + // Removes the Teleport Tablet item from inventory + player.getInventory().delete(tab.get().getTab()); + + } + } +} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/regions/AreaHandler.java b/Elvarg - Server/src/com/elvarg/world/regions/AreaHandler.java deleted file mode 100644 index 0133f89..0000000 --- a/Elvarg - Server/src/com/elvarg/world/regions/AreaHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.elvarg.world.regions; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -import com.elvarg.world.entity.impl.player.Player; -import com.elvarg.world.regions.impl.Lumbridge; - -public class AreaHandler { - private static final List area_set = new ArrayList<>(); - - static { - area_set.add(new Lumbridge()); - } - - private static final Optional area = area_set.stream().filter(Objects::nonNull).findAny(); - - public static void firstClickObject(Player player, int object) { - area.get().sendFirstClickObject(player, object); - } - - public static void secondClickObject(Player player, int object) { - area.get().sendSecondClickObject(player, object); - } - - public static void thirdClickObject(Player player, int object) { - area.get().sendThirdClickObject(player, object); - } - - public static void firstClickNPC(Player player, int npc) { - area.get().sendFirstClickNpc(player, npc); - } - - public static void secondClickNPC(Player player, int npc) { - area.get().sendFirstClickNpc(player, npc); - } - - public static void thirdClickNPC(Player player, int npc) { - area.get().sendFirstClickNpc(player, npc); - } -} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/regions/Areas.java b/Elvarg - Server/src/com/elvarg/world/regions/Areas.java deleted file mode 100644 index 13db916..0000000 --- a/Elvarg - Server/src/com/elvarg/world/regions/Areas.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.elvarg.world.regions; - -import com.elvarg.world.entity.impl.player.Player; - -/** - * This abstracted class constructs how the classes that extends this abstract - * class will be formated as, each abstract void giving it's own special - * function for the player to conduct with. - * - * @author Dennis - * - */ -public interface Areas { - /** - * This abstract void represents the first click option of a object in which - * the player interacts with, an Integer is placed inside the parameter so - * that the abstraction can use the switch(Integer){} function. - * - * @param player - * @param object - */ - public void sendFirstClickObject(Player player, int object); - - /** - * This abstract void represents the second click option of a object in - * which the player interacts with, an Integer is placed inside the - * parameter so that the abstraction can use the switch(Integer){} function. - * - * @param player - * @param object - */ - public void sendSecondClickObject(Player player, int object); - - /** - * This abstract void represents the third click option of a object in which - * the player interacts with, an Integer is placed inside the parameter so - * that the abstraction can use the switch(Integer){} function. - * - * @param player - * @param object - */ - public void sendThirdClickObject(Player player, int object); - - /** - * This abstract void represents the first click option of a npc in which - * the player interacts with, an Integer is placed inside the parameter so - * that the abstraction can use the switch(Integer){} function. - * - * @param player - * @param npc - */ - public void sendFirstClickNpc(Player player, int npc); - - /** - * This abstract void represents the second click option of a npc in which - * the player interacts with, an Integer is placed inside the parameter so - * that the abstraction can use the switch(Integer){} function. - * - * @param player - * @param npc - */ - public void sendSecondClickNpc(Player player, int npc); - - /** - * This abstract void represents the third click option of a npc in which - * the player interacts with, an Integer is placed inside the parameter so - * that the abstraction can use the switch(Integer){} function. - * - * @param player - * @param npc - */ - public void sendThirdClickNpc(Player player, int npc); -} \ No newline at end of file diff --git a/Elvarg - Server/src/com/elvarg/world/regions/impl/Lumbridge.java b/Elvarg - Server/src/com/elvarg/world/regions/impl/Lumbridge.java deleted file mode 100644 index 88110ba..0000000 --- a/Elvarg - Server/src/com/elvarg/world/regions/impl/Lumbridge.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.elvarg.world.regions.impl; - -import com.elvarg.world.entity.impl.player.Player; -import com.elvarg.world.regions.Areas; - -public class Lumbridge implements Areas { - - @Override - public void sendFirstClickObject(Player player, int object) { - switch (object) { - case 381: - player.getPacketSender().sendMessage("test"); - break; - } - } - - @Override - public void sendSecondClickObject(Player player, int object) { - // TODO Auto-generated method stub - - } - - @Override - public void sendThirdClickObject(Player player, int object) { - // TODO Auto-generated method stub - - } - - @Override - public void sendFirstClickNpc(Player player, int npc) { - // TODO Auto-generated method stub - - } - - @Override - public void sendSecondClickNpc(Player player, int npc) { - // TODO Auto-generated method stub - - } - - @Override - public void sendThirdClickNpc(Player player, int npc) { - // TODO Auto-generated method stub - - } - -} diff --git a/Elvarg - Server/src/jaggrab/dispatch/HttpRequestWorker.java b/Elvarg - Server/src/jaggrab/dispatch/HttpRequestWorker.java index 1a7b990..8b8f856 100644 --- a/Elvarg - Server/src/jaggrab/dispatch/HttpRequestWorker.java +++ b/Elvarg - Server/src/jaggrab/dispatch/HttpRequestWorker.java @@ -34,26 +34,19 @@ public final class HttpRequestWorker extends RequestWorker { */ private static final File WWW_DIRECTORY = new File("./data/www/"); - /** - * The default character set. - */ - private static final Charset CHARACTER_SET = Charset.forName("ISO-8859-1"); - @Override protected ChannelRequest nextRequest() throws InterruptedException { return RequestDispatcher.nextHttpRequest(); } @Override + @SuppressWarnings("unused") protected void service(Channel channel, HttpRequest request) throws IOException { String path = request.uri(); ByteBuf buf = ResourceRequester.request(path); - ByteBuf wrappedBuf; HttpResponseStatus status = HttpResponseStatus.OK; - String mimeType = "application/octet-stream"; - if (buf == null) { File f = new File(WWW_DIRECTORY, path); URI target = f.toURI().normalize(); diff --git a/Elvarg - Server/src/jaggrab/dispatch/RequestWorkerPool.java b/Elvarg - Server/src/jaggrab/dispatch/RequestWorkerPool.java index c7d6b25..9bf2faf 100644 --- a/Elvarg - Server/src/jaggrab/dispatch/RequestWorkerPool.java +++ b/Elvarg - Server/src/jaggrab/dispatch/RequestWorkerPool.java @@ -1,6 +1,5 @@ package jaggrab.dispatch; -import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; @@ -48,13 +47,11 @@ public RequestWorkerPool() { * if the file system cannot be created. */ public void start() throws Exception { - File base = new File("./cache/"); for (int i = 0; i < THREADS_PER_REQUEST_TYPE; i++) { workers.add(new JagGrabRequestWorker()); workers.add(new OnDemandRequestWorker()); workers.add(new HttpRequestWorker()); } - for (RequestWorker worker : workers) { service.submit(worker); } diff --git a/README.md b/README.md index 1973905..8b13789 100644 --- a/README.md +++ b/README.md @@ -1,8 +1 @@ -# Elvarg -Elvarg is a #317 protocol rsps. Server was written from scratch, clean, perfect combat, etc.. Good base to start off with. -#317 RSPS Community Server -Users will have opertunity to contribute to the GitHub Repository for any general fixes, contents, etc.. to better improve the base. - -# Release Thread -https://www.rune-server.ee/runescape-development/rs2-server/downloads/651062-elvarg-131osrs-base-netty-4-1-8-jaggrab-perfect-combat-extremely-stable-release.html