Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 30.31 KB | None | 0 0
  1. /*******************************************************************************
  2.  * [ResizableUI_562.java] BEHAVIOR
  3.  *
  4.  * @author NAME
  5.  * @version NUMBER
  6.  *
  7.  * Copyright (c) Avarrocka LTD. 2014 - Avarrocka Client Development.
  8.  ******************************************************************************/
  9. package net.ar.activity.ui.resize.impl;
  10.  
  11. import net.ar.Config;
  12. import net.ar.Constants;
  13. import net.ar.activity.ui.resize.ResizableUI;
  14. import net.ar.activity.ui.util.OrbHandler;
  15. import net.ar.collection.LinkedList;
  16. import net.ar.cache.unit.NPCType;
  17. import net.ar.cache.unit.Interface;
  18. import net.ar.media.Rasterizer2D;
  19. import net.ar.media.img.RGBImage;
  20. import net.ar.util.string.StringUtils;
  21. import net.ar.world.model.Model;
  22. import net.ar.world.model.NPC;
  23. import net.ar.world.model.Player;
  24.  
  25. import java.awt.*;
  26.  
  27. /**
  28.  * Avarrocka Client Development
  29.  *
  30.  * @version 0.1
  31.  */
  32. public class ResizableUI_562 extends ResizableUI {
  33.  
  34.     private int chatboxHeight = 114;
  35.     private int chatboxResizeClickY = -1;
  36.     private int chatboxResizeFromY = -1;
  37.  
  38.     @Override
  39.     public void buildChat() {
  40.         final String[] modes = {"View", "On", "Friends", "Off", "Hide"};
  41.         if(client.mouseX >= 5 && client.mouseX <= 61 && client.mouseY >= client.windowHeight - 21 && client.mouseY <= client.windowHeight) {
  42.             client.menuItemName[1] = "View All";
  43.             client.menuItemCode[1] = 999;
  44.             client.menuPos = 2;
  45.             client.hoveredChannelButton = 0;
  46.         } else if(client.mouseX >= 62 && client.mouseX <= 118 && client.mouseY >= client.windowHeight - 21 && client.mouseY <= client.windowHeight) {
  47.             client.menuItemName[1] = "View Game";
  48.             client.menuItemCode[1] = 998;
  49.             client.menuPos = 2;
  50.             client.hoveredChannelButton = 1;
  51.         } else if(client.mouseX >= 119 && client.mouseX <= 175 && client.mouseY >= client.windowHeight - 21 && client.mouseY <= client.windowHeight) {
  52.             for(int i = 0; i <= 4; i++) {
  53.                 client.menuItemName[i + 1] = modes[4 - i] + " public";
  54.                 client.menuItemCode[i + 1] = 997 - i;
  55.             }
  56.             client.menuPos = 6;
  57.             client.hoveredChannelButton = 2;
  58.         } else if(client.mouseX >= 176 && client.mouseX <= 232 && client.mouseY >= client.windowHeight - 21 && client.mouseY <= client.windowHeight) {
  59.             for(int i = 0; i <= 3; i++) {
  60.                 client.menuItemName[i + 1] = modes[3 - i] + " private";
  61.                 client.menuItemCode[i + 1] = 992 - i;
  62.             }
  63.             client.menuPos = 5;
  64.             client.hoveredChannelButton = 3;
  65.         } else if(client.mouseX >= 233 && client.mouseX <= 289 && client.mouseY >= client.windowHeight - 21 && client.mouseY <= client.windowHeight) {
  66.             for(int i = 0; i <= 3; i++) {
  67.                 client.menuItemName[i + 1] = modes[3 - i] + " clan chat";
  68.                 client.menuItemCode[i + 1] = 1003 - i;
  69.             }
  70.             client.menuPos = 5;
  71.             client.hoveredChannelButton = 4;
  72.         } else if(client.mouseX >= 290 && client.mouseX <= 344 && client.mouseY >= client.windowHeight - 21 && client.mouseY <= client.windowHeight) {
  73.             for(int i = 0; i <= 3; i++) {
  74.                 client.menuItemName[i + 1] = modes[3 - i] + " trade";
  75.                 client.menuItemCode[i + 1] = 987 - i;
  76.             }
  77.             client.menuPos = 5;
  78.             client.hoveredChannelButton = 5;
  79.         } else if(client.mouseX >= 404 && client.mouseX <= 514 && client.mouseY >= client.windowHeight - 21 && client.mouseY <= client.windowHeight) {
  80.             client.hoveredChannelButton = 6;
  81.         } else if(client.hoveredChannelButton != -1) {
  82.             client.hoveredChannelButton = -1;
  83.         }
  84.         if(client.forcedChatWidgetId == -1 && client.showChat) {
  85.             client.chatWidget.scrollPos = client.chatContentHeight - client.chatScrollPos - chatboxHeight;
  86.             if(client.mouseX > 478 && client.mouseX < 580 &&
  87.                     client.mouseY >= client.windowHeight - chatboxHeight - 48 &&
  88.                     client.mouseY <= client.windowHeight - 47) {
  89.                 client.gameActivity.processScrollbar(496, client.windowHeight - chatboxHeight - 48, client.mouseX, client.mouseY, chatboxHeight, client.chatContentHeight, client.chatWidget);
  90.             }
  91.             int pos = client.chatContentHeight - chatboxHeight - client.chatWidget.scrollPos;
  92.             if(client.mouseWheelAmt != 0 && client.mouseWheelX >= 8 && client.mouseWheelX <= 511 &&
  93.                     client.mouseWheelY >= client.windowHeight - chatboxHeight - 48 &&
  94.                     client.mouseWheelY <= client.windowHeight - 47) {
  95.                 pos -= 30 * client.mouseWheelAmt;
  96.             }
  97.             if(pos < 0) {
  98.                 pos = 0;
  99.             }
  100.             if(pos > client.chatContentHeight - chatboxHeight) {
  101.                 pos = client.chatContentHeight - chatboxHeight;
  102.             }
  103.             if(client.chatScrollPos != pos) {
  104.                 client.chatScrollPos = pos;
  105.             }
  106.         }
  107.     }
  108.  
  109.     @Override
  110.     public void updateChat() {
  111.         int yoff = client.windowHeight - 165;
  112.         if(client.messagePromptRaised || client.inputDialogState > 0 || client.chatBoxStatement != null || client.forcedChatWidgetId != -1 || client.chatWidgetId != -1) {
  113.             client.cacheSprite[67].drawImage(0, client.windowHeight - 166);
  114.             Rasterizer2D.fillRectangle(7, client.windowHeight - 159, 506, 129, 0xccbb9a, 150);
  115.         } else {
  116.             yoff -= 3;
  117.             if(client.showChat) {
  118.                 client.cacheSprite[213].drawImage(256, client.windowHeight - chatboxHeight - 59, 64);
  119.                 int alpha;
  120.                 for(int i = 0; i < chatboxHeight; i++) {
  121.                     alpha = (int) (64 * i / (float) chatboxHeight);
  122.                     Rasterizer2D.drawHorizontalLine(8, client.windowHeight - chatboxHeight - 47 + i, 504, 0, alpha);
  123.                 }
  124.                 Rasterizer2D.fillRectangle(8, yoff + 122, 504, 17, 0, 64);
  125.             }
  126.         }
  127.         displayChannelButtons();
  128.         if(client.messagePromptRaised) {
  129.             client.boldFont.drawCenteredString(client.promptInputTitle, 259, yoff + 60, 0);
  130.             client.boldFont.drawCenteredString(client.promptInput + "*", 259, yoff + 80, 128);
  131.         } else if(client.inputDialogState == 1) {
  132.             client.boldFont.drawCenteredString("Enter amount:", 259, yoff + 60, 0);
  133.             client.boldFont.drawCenteredString(client.amountOrNameInput + "*", 259, yoff + 80, 128);
  134.         } else if(client.inputDialogState == 2) {
  135.             client.boldFont.drawCenteredString("Enter name:", 259, yoff + 60, 0);
  136.             client.boldFont.drawCenteredString(client.amountOrNameInput + "*", 259, yoff + 80, 128);
  137.         } else if(client.chatBoxStatement != null) {
  138.             client.boldFont.drawCenteredString(client.chatBoxStatement, 259, yoff + 60, 0);
  139.             client.boldFont.drawCenteredString("Click to continue", 259, yoff + 80, 128);
  140.         } else if(client.forcedChatWidgetId != -1) {
  141.             client.drawWidget(Interface.cache[client.forcedChatWidgetId], 20, yoff + 20, 0);
  142.         } else if(client.chatWidgetId != -1) {
  143.             client.drawWidget(Interface.cache[client.chatWidgetId], 20, yoff + 20, 0);
  144.         } else if(client.showChat) {
  145.             int line = 0;
  146.             Rasterizer2D.setClip(8, client.windowHeight - chatboxHeight - 47, 496, client.windowHeight - 47);
  147.             int basicFontColor = 0xffffff;
  148.             int blueFontColor = 0x7fa9ff;
  149.             int redFontColor = 0xff5256;
  150.             int purpleFontColor = 0xff78d9;
  151.             int orangeFontColor = 0xff8c38;
  152.             boolean fontShadow = true;
  153.             int view = client.chatTypeView;
  154.             for(int i = 0; i < 500; i++) {
  155.                 if(client.chatMessage[i] != null) {
  156.                     int x = 10;
  157.                     int y = (chatboxHeight - 14 * line) + client.chatScrollPos + client.windowHeight - chatboxHeight - 53;
  158.                     if(y <= client.windowHeight - chatboxHeight - 47 || y >= client.windowHeight - 36) {
  159.                         line++;
  160.                         continue;
  161.                     }
  162.                     int type = client.chatType[i];
  163.                     String author = client.chatAuthor[i];
  164.                     String msg = client.chatMessage[i];
  165.                     byte rights = 0;
  166.                     if(author != null && author.startsWith("@cr")) {
  167.                         rights = Byte.parseByte(Character.toString(author.charAt(3)));
  168.                         author = author.substring(5);
  169.                     }
  170.                     if(!client.uiRenderer.canSeeMessage(type, view, rights, author)) {
  171.                         continue;
  172.                     }
  173.                     if(type == 0) {
  174.                         client.plainFont.drawLeftAlignedEffectString(msg, x, y, basicFontColor, fontShadow);
  175.                     } else if(type == 1) {
  176.                         if(rights >= 1) {
  177.                             client.modIcons[rights - 1].drawImage(x + 1, y - 12);
  178.                             x += 14;
  179.                         }
  180.                         client.plainFont.drawLeftAlignedString(author + ":", x + 1, y + 1, 0);
  181.                         client.plainFont.drawLeftAlignedString(author + ":", x, y, basicFontColor);
  182.                         x += client.plainFont.getStringWidth(author + ": ");
  183.                         client.plainFont.drawLeftAlignedString(msg, x + 1, y + 1, 0);
  184.                         client.plainFont.drawLeftAlignedString(msg, x, y, blueFontColor);
  185.                     } else if(type == 2) {
  186.                         client.plainFont.drawLeftAlignedString("From", x + 1, y + 1, 0);
  187.                         client.plainFont.drawLeftAlignedString("From", x, y, redFontColor);
  188.                         x += client.plainFont.getStringWidth("From ") + 12;
  189.                         if(rights >= 1) {
  190.                             client.modIcons[rights - 1].drawImage(x, y - 12);
  191.                         } else {
  192.                             x -= 12;
  193.                         }
  194.                         client.plainFont.drawLeftAlignedString(author + ":  " + client.chatMessage[i], x + 1, y + 1, 0);
  195.                         client.plainFont.drawLeftAlignedString(author + ":  " + client.chatMessage[i], x, y, redFontColor);
  196.                     } else if(type == 4) {
  197.                         client.plainFont.drawLeftAlignedString(author + ":  " + msg, x + 1, y + 1, 0);
  198.                         client.plainFont.drawLeftAlignedString(author + ":  " + msg, x, y, purpleFontColor);
  199.                     } else if(type == 5) {
  200.                         client.plainFont.drawLeftAlignedString(msg, x + 1, y + 1, 0);
  201.                         client.plainFont.drawLeftAlignedString(msg, x, y, redFontColor);
  202.                     } else if(type == 6) {
  203.                         client.plainFont.drawLeftAlignedString("To " + author + ": " + msg, x + 1, y + 1, 0);
  204.                         client.plainFont.drawLeftAlignedString("To " + author + ": " + msg, x, y, redFontColor);
  205.                     } else if(type == 7) {
  206.                         final int split = author.indexOf(":");
  207.                         final String clan = author.substring(0, split);
  208.                         author = author.substring(split + 1);
  209.                         client.plainFont.drawLeftAlignedString("[", x + 1, y + 1, 0);
  210.                         client.plainFont.drawLeftAlignedString("[", x, y, 0xffffff);
  211.                         x += 5;
  212.                         client.plainFont.drawLeftAlignedString(clan, x + 1, y + 1, 0);
  213.                         client.plainFont.drawLeftAlignedString(clan, x, y, 0x7fa9ff);
  214.                         x += client.plainFont.getStringWidth(clan);
  215.                         client.plainFont.drawLeftAlignedString("]", x + 1, y + 1, 0);
  216.                         client.plainFont.drawLeftAlignedString("]", x, y, 0xffffff);
  217.                         x += 7;
  218.                         if(rights >= 1) {
  219.                             client.modIcons[rights - 1].drawImage(x, y - 12);
  220.                             x += 13;
  221.                         }
  222.                         client.plainFont.drawLeftAlignedString(author + ":", x + 1, y + 1, 0);
  223.                         client.plainFont.drawLeftAlignedString(author + ":", x, y, 0xffffff);
  224.                         x += client.plainFont.getStringWidth(author) + 6;
  225.                         client.plainFont.drawLeftAlignedString(msg, x + 1, y + 1, 0);
  226.                         client.plainFont.drawLeftAlignedString(msg, x, y, 0xff5256);
  227.                     } else if(type == 8) {
  228.                         client.plainFont.drawLeftAlignedString(author + " " + msg, x + 1, y + 1, 0);
  229.                         client.plainFont.drawLeftAlignedString(author + " " + msg, x, y, orangeFontColor);
  230.                     }
  231.                     line++;
  232.                 }
  233.             }
  234.             Rasterizer2D.removeClip();
  235.             client.chatContentHeight = line * 14 + 7;
  236.             if(client.chatContentHeight < chatboxHeight) {
  237.                 client.chatContentHeight = chatboxHeight;
  238.             }
  239.             client.gameActivity.drawWhiteScrollbar(496, client.windowHeight - chatboxHeight - 48, chatboxHeight, client.chatContentHeight, client.chatContentHeight - client.chatScrollPos - chatboxHeight);
  240.             String myName;
  241.             if(client.localPlayer != null && client.localPlayer.name != null) {
  242.                 myName = client.localPlayer.name;
  243.             } else {
  244.                 myName = StringUtils.formatName(client.localUsername);
  245.             }
  246.             client.plainFont.drawLeftAlignedString(myName + ":", 11, yoff + 134, 0);
  247.             client.plainFont.drawLeftAlignedString(myName + ":", 10, yoff + 133, 0xffffff);
  248.             client.plainFont.drawLeftAlignedString(client.chatInput + "*", 12 + client.plainFont.getEffectStringWidth(myName + ": "), yoff + 134, 0);
  249.             client.plainFont.drawLeftAlignedString(client.chatInput + "*", 11 + client.plainFont.getEffectStringWidth(myName + ": "), yoff + 133, 0x7fa9ff);
  250.             for(int i = 0; i < 504; i++) {
  251.                 int opacity = 100 - (int) (i / 5.05);
  252.                 Rasterizer2D.drawPoint(8 + i, client.windowHeight - chatboxHeight - 48, 0xffffff, opacity);
  253.                 Rasterizer2D.drawPoint(8 + i, client.windowHeight - 47, 0xffffff, opacity);
  254.             }
  255.         }
  256.         client.gameGraphics.setCanvas();
  257.     }
  258.  
  259.     @Override
  260.     public void buildMap() {
  261.         if(client.mouseInRegion(client.windowWidth - 180, 3, client.windowWidth - 145, 38)) {
  262.             client.menuItemName[1] = "Face North";
  263.             client.menuItemCode[1] = 1014;
  264.             client.menuPos = 2;
  265.         }
  266.     }
  267.  
  268.     @Override
  269.     public void updateMap() {
  270.         for(int i = 0; i < 76; i++) {
  271.             int amt = (int) (Math.sqrt(Math.pow(77, 2) - Math.pow(75 - i, 2)));
  272.             client.minimapLineLengths[i] = 2 * amt + 2;
  273.             client.minimapLineLengths[150 - i] = 2 * amt + 2;
  274.             client.minimapLineStarts[i] = -amt + 73;
  275.             client.minimapLineStarts[150 - i] = -amt + 73;
  276.         }
  277.         int xOffset = client.windowWidth - 182;
  278.         if(client.minimapOverlay == 2) {
  279.             client.cacheSprite[84].drawImage(xOffset + 18, 0);
  280.             client.cacheSprite[85].drawImage(xOffset + 23, 5);
  281.             client.cacheSprite[83].drawImage(xOffset + 13, 0);
  282.             client.compassImage.drawRotatedImage(xOffset + 25, 5, 33, 33, 25, 25, client.compassClipStarts, client.compassLineLengths, client.cameraAngleX, 256);
  283.             return;
  284.         }
  285.         int rotation = client.cameraAngleX + client.minimapAngle & 0x7ff;
  286.         int middleX = 48 + client.localPlayer.x / 32;
  287.         int middleY = 464 - client.localPlayer.y / 32;
  288.         client.minimapImage.drawRotatedImage(xOffset + 25, 5, 146, 151, middleX, middleY, client.minimapLineStarts, client.minimapLineLengths, rotation, 256 + client.minimapZoom);
  289.         for(int i = 0; i < client.mapFunctionCount; i++) {
  290.             int x = (client.mapFunctionX[i] * 4 + 2) - client.localPlayer.x / 32;
  291.             int y = (client.mapFunctionY[i] * 4 + 2) - client.localPlayer.y / 32;
  292.             markMinimap(client.mapFunctionImage[i], x, y);
  293.         }
  294.         for(int tileX = 0; tileX < 104; tileX++) {
  295.             for(int tileY = 0; tileY < 104; tileY++) {
  296.                 LinkedList sceneItem = client.sceneItems[client.cameraPlane][tileX][tileY];
  297.                 if(sceneItem != null) {
  298.                     int x = (tileX * 4 + 2) - client.localPlayer.x / 32;
  299.                     int y = (tileY * 4 + 2) - client.localPlayer.y / 32;
  300.                     markMinimap(client.mapDotItem, x, y);
  301.                 }
  302.             }
  303.         }
  304.         for(int i6 = 0; i6 < client.npcListSize; i6++) {
  305.             NPC npc = client.npcList[client.npcEntryList[i6]];
  306.             if(npc != null && npc.isVisible()) {
  307.                 NPCType npcDefinition = npc.type;
  308.                 if(npcDefinition.subId != null) {
  309.                     npcDefinition = npcDefinition.getSubNPCType();
  310.                 }
  311.                 if(npcDefinition != null && npcDefinition.aBoolean87 && npcDefinition.aBoolean84) {
  312.                     int x = npc.x / 32 - client.localPlayer.x / 32;
  313.                     int y = npc.y / 32 - client.localPlayer.y / 32;
  314.                     markMinimap(client.mapDotNPC, x, y);
  315.                 }
  316.             }
  317.         }
  318.         for(int j6 = 0; j6 < client.playerCount; j6++) {
  319.             Player player = client.playerList[client.playerEntryList[j6]];
  320.             if(player != null && player.isVisible()) {
  321.                 int x = player.x / 32 - client.localPlayer.x / 32;
  322.                 int y = player.y / 32 - client.localPlayer.y / 32;
  323.                 boolean friend = false;
  324.                 long l6 = StringUtils.encryptName(player.name);
  325.                 for(int k6 = 0; k6 < client.friendsCount; k6++) {
  326.                     if(l6 != client.friendsListAsLongs[k6] || client.friendsNodeIDs[k6] == 0) {
  327.                         continue;
  328.                     }
  329.                     friend = true;
  330.                     break;
  331.                 }
  332.                 boolean team = false;
  333.                 if(client.localPlayer.team != 0 && player.team != 0 && client.localPlayer.team == player.team) {
  334.                     team = true;
  335.                 }
  336.                 if(friend) {
  337.                     markMinimap(client.mapDotFriend, x, y);
  338.                 } else if(team) {
  339.                     markMinimap(client.mapDotTeam, x, y);
  340.                 } else {
  341.                     markMinimap(client.mapDotPlayer, x, y);
  342.                 }
  343.             }
  344.         }
  345.         if(client.hintType != 0 && client.loopCycle % 20 < 10) {
  346.             if(client.hintType == 1 && client.NPCHintID >= 0 && client.NPCHintID < client.npcList.length) {
  347.                 NPC npc = client.npcList[client.NPCHintID];
  348.                 if(npc != null) {
  349.                     int x = npc.x / 32 - client.localPlayer.x / 32;
  350.                     int y = npc.y / 32 - client.localPlayer.y / 32;
  351.                     method81(client.mapArrow, x, y);
  352.                 }
  353.             }
  354.             if(client.hintType == 2) {
  355.                 int x = ((client.anInt934 - client.baseX) * 4 + 2) - client.localPlayer.x / 32;
  356.                 int y = ((client.anInt935 - client.baseY) * 4 + 2) - client.localPlayer.y / 32;
  357.                 method81(client.mapArrow, x, y);
  358.             }
  359.             if(client.hintType == 10 && client.anInt933 >= 0 && client.anInt933 < client.playerList.length) {
  360.                 Player player = client.playerList[client.anInt933];
  361.                 if(player != null) {
  362.                     int x = player.x / 32 - client.localPlayer.x / 32;
  363.                     int y = player.y / 32 - client.localPlayer.y / 32;
  364.                     method81(client.mapArrow, x, y);
  365.                 }
  366.             }
  367.         }
  368.         if(client.walkX != 0) {
  369.             int x = (client.walkX * 4 + 2) - client.localPlayer.x / 32;
  370.             int y = (client.walkY * 4 + 2) - client.localPlayer.y / 32;
  371.             markMinimap(client.mapFlag, x, y);
  372.         }
  373.         Rasterizer2D.removeClip();
  374.         client.cacheSprite[84].drawImage(xOffset + 18, 0);
  375.         client.cacheSprite[83].drawImage(xOffset + 13, 0);
  376.         client.compassImage.drawRotatedImage(xOffset + 18, 5, 33, 33, 25, 25, client.compassClipStarts, client.compassLineLengths, client.cameraAngleX, 256);
  377.         Rasterizer2D.fillRectangle(xOffset + 97, 78, 3, 3, 0xffffff);
  378.         if(Config.HEALTH_ORB_ENABLED) {
  379.             displayOrb(client.windowWidth - 209, 38, Constants.ORB_HEALTH, false);
  380.         }
  381.         if(Config.PRAYER_ORB_ENABLED) {
  382.             displayOrb(client.windowWidth - 212, 72, Constants.ORB_PRAYER, true);
  383.         }
  384.         if(Config.RUN_ORB_ENABLED) {
  385.             displayOrb(client.windowWidth - 200, 106, Constants.ORB_RUN, true);
  386.         }
  387.         if(Config.SUMMONING_ORB_ENABLED) {
  388.             displayOrb(client.windowWidth - 177, 140, Constants.ORB_SUMMONING, true);
  389.         }
  390.         client.gameGraphics.setCanvas();
  391.     }
  392.  
  393.     @Override
  394.     public void buildInventory() {
  395.         if(client.mouseWheelAmt != 0 && client.olderTabInterfaces[client.invTab] != -1) {
  396.             Interface tab = Interface.cache[client.olderTabInterfaces[client.invTab]];
  397.             if(tab.subId != null) {
  398.                 int posX = client.windowWidth - 197;
  399.                 int posY = client.windowHeight - 303;
  400.                 if(client.windowWidth < 1000) {
  401.                     posY -= 36;
  402.                 }
  403.                 Interface widget = null;
  404.                 for(int index = 0; index < tab.subId.length; index++) {
  405.                     if(Interface.cache[tab.subId[index]].scrollMax > 0) {
  406.                         posX += tab.subX[index];
  407.                         posY += tab.subY[index];
  408.                         widget = Interface.cache[tab.subId[index]];
  409.                         break;
  410.                     }
  411.                 }
  412.                 if(widget != null && client.mouseWheelX > posX && client.mouseWheelX < posX + widget.width + 16 &&
  413.                         client.mouseWheelY > posY && client.mouseWheelY < posY + widget.height) {
  414.                     widget.scrollPos += client.mouseWheelAmt * 30;
  415.                     if(widget.scrollPos < 0) {
  416.                         widget.scrollPos = 0;
  417.                     } else if(widget.scrollPos > widget.scrollMax) {
  418.                         widget.scrollPos = widget.scrollMax;
  419.                     }
  420.                 }
  421.             }
  422.         }
  423.         if(client.clickButton != 1) {
  424.             return;
  425.         }
  426.         if(client.windowWidth < 1000) {
  427.             if(client.clickX > client.windowWidth - 240 && client.clickY > client.windowHeight - 72) {
  428.                 int tabClick = (client.clickX - (client.windowWidth - 240)) / 30;
  429.                 if(client.clickY > client.windowHeight - 36) {
  430.                     tabClick += 8;
  431.                 }
  432.                 if(tabClick == client.invTab && client.showTab) {
  433.                     client.showTab = false;
  434.                 } else if(client.newerTabInterfaces[tabClick] != -1) {
  435.                     client.showTab = true;
  436.                     client.invTab = tabClick;
  437.                 }
  438.             }
  439.         } else if(client.clickX > client.windowWidth - 480 && client.clickY > client.windowHeight - 36) {
  440.             final int tabClick = (client.clickX - (client.windowWidth - 480)) / 30;
  441.             if(tabClick == client.invTab && client.showTab) {
  442.                 client.showTab = false;
  443.             } else if(client.newerTabInterfaces[tabClick] != -1) {
  444.                 client.showTab = true;
  445.                 client.invTab = tabClick;
  446.             }
  447.         }
  448.     }
  449.  
  450.     @Override
  451.     public void updateInventory() {
  452.         int xOffset = client.windowWidth - 197;
  453.         int yOffset = client.windowHeight - 303;
  454.         if(client.windowWidth < 1000) {
  455.             client.cacheSprite[39].drawImage(xOffset - 43, yOffset + 231);
  456.             client.cacheSprite[39].drawImage(xOffset - 43, yOffset + 267);
  457.         } else {
  458.             client.cacheSprite[39].drawImage(xOffset - 43, yOffset + 267);
  459.             client.cacheSprite[39].drawImage(xOffset - 283, yOffset + 267);
  460.         }
  461.         if(client.invOverlayInterfaceID == -1) {
  462.             displayHoveredTab();
  463.             displaySelectedTabHighlight();
  464.             displaySideIcons();
  465.         }
  466.         if(client.showTab) {
  467.             if(client.windowWidth < 1000) {
  468.                 Rasterizer2D.fillRectangle(xOffset, yOffset - 36, 190, 269, 0x50463C, 100);
  469.                 client.cacheSprite[47].drawImage(xOffset - 7, yOffset - 43);
  470.             } else {
  471.                 Rasterizer2D.fillRectangle(xOffset, yOffset, 190, 269, 0x50463C, 100);
  472.                 client.cacheSprite[47].drawImage(xOffset - 7, yOffset - 7);
  473.             }
  474.             if(client.invOverlayInterfaceID != -1) {
  475.                 client.drawWidget(Interface.cache[client.invOverlayInterfaceID], xOffset, yOffset - (client.windowWidth < 1000 ? 36 : 0), 0);
  476.             } else if(client.newerTabInterfaces[client.invTab] != -1) {
  477.                 client.drawWidget(Interface.cache[client.newerTabInterfaces[client.invTab]], xOffset, yOffset - (client.windowWidth < 1000 ? 36 : 0), 0);
  478.             }
  479.         }
  480.     }
  481.  
  482.     @Override
  483.     public Point getOnScreenWidgetOffsets() {
  484.         return super.getOnScreenWidgetOffsets();
  485.     }
  486.  
  487.     @Override
  488.     public boolean allowScene() {
  489.         if(client.showChat && !(client.messagePromptRaised || client.inputDialogState > 0 || client.chatBoxStatement != null || client.forcedChatWidgetId != -1 || client.chatWidgetId != -1)) {
  490.             if(client.mouseDragButton != 1) {
  491.                 chatboxResizeClickY = -1;
  492.             } else if(chatboxResizeClickY == -1 && client.clickX >= 256 && client.clickY >= client.windowHeight - chatboxHeight - 59 &&
  493.                     client.clickX <= 264 && client.clickY <= client.windowHeight - chatboxHeight - 50) {
  494.                 chatboxResizeFromY = chatboxHeight;
  495.                 chatboxResizeClickY = client.clickY;
  496.             }
  497.             if(chatboxResizeClickY != -1) {
  498.                 chatboxHeight = chatboxResizeFromY + (chatboxResizeClickY - client.mouseY);
  499.                 if(chatboxHeight < 114) {
  500.                     chatboxHeight = 114;
  501.                 }
  502.                 return false;
  503.             }
  504.         }
  505.         if(client.mouseX < 0 || client.mouseY < 0) {
  506.             return false;
  507.         }
  508.         if(client.mouseX >= (client.windowWidth < 1000 ? client.windowWidth - 240 : client.windowWidth - 480) && client.mouseY >= (client.windowWidth < 1000 ? client.windowHeight - 72 : client.windowHeight - 36)) {
  509.             return false;
  510.         }
  511.         if(client.mouseX >= client.windowWidth - 204 && client.mouseY >= (client.windowWidth < 980 ? client.windowHeight - 346 : client.windowHeight - 310) && client.showTab) {
  512.             return false;
  513.         }
  514.         if(client.mouseX <= 518 & client.mouseY >= client.windowHeight - 22) {
  515.             return false;
  516.         }
  517.         if(client.messagePromptRaised || client.inputDialogState > 0 || client.chatBoxStatement != null || client.forcedChatWidgetId != -1 || client.chatWidgetId != -1) {
  518.             if(client.mouseX <= 518 & client.mouseY >= client.windowHeight - 166) {
  519.                 return false;
  520.             }
  521.         } else if(client.showChat) {
  522.             if(client.mouseX <= 518 && client.mouseY >= client.windowHeight - chatboxHeight - 48) {
  523.                 System.out.println(Math.random());
  524.                 return false;
  525.             } else if(client.mouseX >= 256 && client.mouseY >= client.windowHeight - chatboxHeight - 59 &&
  526.                     client.mouseX <= 264 && client.mouseY <= client.windowHeight - chatboxHeight - 50) {
  527.                 return false;
  528.    
  529.             }
  530.         }
  531.         if(client.mouseY <= 165 & client.mouseX >= client.windowWidth - 182) {
  532.             return false;
  533.         }
  534.         return true;
  535.     }
  536.  
  537.     @Override
  538.     public void buildSceneOverlay() {
  539.     }
  540.  
  541.     public void method81(RGBImage icon, int x, int y) {
  542.         final int l = x * x + y * y;
  543.         if(l > 4225 && l < 0x15f90) {
  544.             final int i1 = client.cameraAngleX + client.minimapAngle & 0x7ff;
  545.             int j1 = Model.angleSine[i1];
  546.             int k1 = Model.angleCosine[i1];
  547.             j1 = (j1 << 8) / (client.minimapZoom + 256);
  548.             k1 = (k1 << 8) / (client.minimapZoom + 256);
  549.             final int l1 = y * j1 + x * k1 >> 16;
  550.             final int i2 = y * k1 - x * j1 >> 16;
  551.             final double d = Math.atan2(l1, i2);
  552.             final int j2 = (int) (Math.sin(d) * 63D);
  553.             final int k2 = (int) (Math.cos(d) * 57D);
  554.             client.cacheSprite[85].method353(94 + j2 + 4, 83 - k2 - 20, d);
  555.         } else {
  556.             int xOffset = client.windowWidth - 182;
  557.             markMinimap(icon, xOffset + x, y);
  558.         }
  559.     }
  560.  
  561.     public void markMinimap(RGBImage icon, int x, int y) {
  562.         final int rotation = client.cameraAngleX + client.minimapAngle & 0x7ff;
  563.         final int z = x * x + y * y;
  564.         if(z > 6400) {
  565.             return;
  566.         }
  567.         int sin = Model.angleSine[rotation];
  568.         int cos = Model.angleCosine[rotation];
  569.         sin = (sin << 8) / (client.minimapZoom + 256);
  570.         cos = (cos << 8) / (client.minimapZoom + 256);
  571.         final int fx = y * sin + x * cos >> 16;
  572.         final int fy = y * cos - x * sin >> 16;
  573.         int xOffset = client.windowWidth - 182;
  574.         int yOffset = -4;
  575.         icon.drawImage(94 + fx - icon.imageOriginalWidth / 2 + xOffset + 4, 83 - fy - icon.imageOriginalHeight / 2 - 8 + 8 + yOffset);
  576.     }
  577.  
  578.     /**
  579.      * Displays the hovered tab.
  580.      */
  581.     private void displayHoveredTab() {
  582.         if(client.windowWidth < 1000) {
  583.             if(client.mouseY < client.windowHeight - 36 && client.mouseY > client.windowHeight - 72) {
  584.                 for(int i = 8; i >= 1; i--) {
  585.                     if(client.windowWidth - 270 < client.mouseX - (i * 30)) {
  586.                         if(client.newerTabInterfaces[i - 1] != -1) {
  587.                             client.cacheSprite[19].drawImage(i * 30 + (client.windowWidth - 270), client.windowHeight - 72);
  588.                         }
  589.                         return;
  590.                     }
  591.                 }
  592.             } else if(client.mouseY > client.windowHeight - 37) {
  593.                 for(int i = 8; i >= 1; i--) {
  594.                     if(client.windowWidth - 270 < client.mouseX - (i * 30)) {
  595.                         if(client.newerTabInterfaces[i + 7] != -1) {
  596.                             client.cacheSprite[19].drawImage(i * 30 + (client.windowWidth - 270), client.windowHeight - 36);
  597.                         }
  598.                         return;
  599.                     }
  600.                 }
  601.             }
  602.         } else {
  603.             if(client.mouseY > client.windowHeight - 37) {
  604.                 for(int i = 16; i >= 1; i--) {
  605.                     if(client.windowWidth - 510 < client.mouseX - (i * 30)) {
  606.                         if(client.newerTabInterfaces[i - 1] != -1) {
  607.                             client.cacheSprite[19].drawImage(i * 30 + (client.windowWidth - 510), client.windowHeight - 36);
  608.                         }
  609.                         return;
  610.                     }
  611.                 }
  612.             }
  613.         }
  614.     }
  615.  
  616.     /**
  617.      * Displays the selected tab.
  618.      */
  619.     private void displaySelectedTabHighlight() {
  620.         if(client.newerTabInterfaces[client.invTab] == -1) {
  621.             return;
  622.         }
  623.         for(int i = 0; i < 14; i++) {
  624.             if(client.invTab == i && client.showTab) {
  625.                 if(client.windowWidth < 1000) {
  626.                     if(i < 8) {
  627.                         client.cacheSprite[21].drawAlphaImage((client.windowWidth - 245) + 30 * i, client.windowHeight - 71);
  628.                     } else {
  629.                         client.cacheSprite[21].drawAlphaImage((client.windowWidth - 245) + 30 * (i - 8), client.windowHeight - 35);
  630.                     }
  631.                 } else {
  632.                     client.cacheSprite[21].drawAlphaImage((client.windowWidth - 485) + 30 * i, client.windowHeight - 35);
  633.                 }
  634.             }
  635.         }
  636.     }
  637.  
  638.     /**
  639.      * Displays the side icons.
  640.      */
  641.     private void displaySideIcons() {
  642.         if(client.windowWidth < 1000) {
  643.             for(int i = 0; i < 16; i++) {
  644.                 if(client.newerTabInterfaces[i] != -1) {
  645.                     int xOffset = 16 - client.cacheSprite[i + 22].imageWidth / 2;
  646.                     int yOffset = 18 - client.cacheSprite[i + 22].imageHeight / 2;
  647.                     if(i < 8) {
  648.                         client.cacheSprite[22 + i].drawImage(xOffset + client.windowWidth - 242 + 30 * i, yOffset + client.windowHeight - 71);
  649.                     } else {
  650.                         client.cacheSprite[22 + i].drawImage(xOffset + client.windowWidth - 242 + 30 * (i - 8), yOffset + client.windowHeight - 35);
  651.                     }
  652.                 }
  653.             }
  654.         } else {
  655.             for(int i = 0; i < 16; i++) {
  656.                 int xOffset = 16 - client.cacheSprite[i + 22].imageWidth / 2;
  657.                 int yOffset = 18 - client.cacheSprite[i + 22].imageHeight / 2;
  658.                 if(client.newerTabInterfaces[i] != -1) {
  659.                     client.cacheSprite[22 + i].drawImage(xOffset + client.windowWidth - 482 + 30 * i, yOffset + client.windowHeight - 34);
  660.                 }
  661.             }
  662.         }
  663.     }
  664.  
  665.     /**
  666.      * Displays the chat channel buttons.
  667.      */
  668.     private void displayChannelButtons() {
  669.         int y = 0;
  670.         y = client.windowHeight - 165;
  671.         client.cacheSprite[65].drawImage(5, y + 142);
  672.         String text[] = {"On", "Friends", "Off", "Hide"};
  673.         int textColor[] = {65280, 0xffff00, 0xff0000, 65535};
  674.         for(int i = 0; i <= 5; i++) {
  675.             if(client.selectedChannelButton == i && (client.showChat)) {
  676.                 client.chatButtons[1].drawImage(5 + 57 * i, y + 142);
  677.             }
  678.             if(i == client.hoveredChannelButton) {
  679.                 if(client.hoveredChannelButton == client.selectedChannelButton && (client.showChat)) {
  680.                     client.chatButtons[2].drawImage(5 + 57 * i, y + 142);
  681.                 } else {
  682.                     client.chatButtons[0].drawImage(5 + 57 * i, y + 142);
  683.                 }
  684.             }
  685.         }
  686.         if(client.hoveredChannelButton == 6) {
  687.             client.chatButtons[3].drawImage(404, y + 143);
  688.         }
  689.         client.smallFont.drawLeftAlignedEffectString("Report Abuse", 425, y + 157, 0xffffff, true);
  690.         client.smallFont.drawLeftAlignedEffectString("All", 26, y + 157, 0xffffff, true);
  691.         client.smallFont.drawLeftAlignedEffectString("Game", 78, y + 152, 0xffffff, true);
  692.         client.smallFont.drawLeftAlignedEffectString("Public", 132, y + 152, 0xffffff, true);
  693.         client.smallFont.drawLeftAlignedEffectString("Private", 187, y + 152, 0xffffff, true);
  694.         client.smallFont.drawLeftAlignedEffectString("Clan", 249, y + 152, 0xffffff, true);
  695.         client.smallFont.drawLeftAlignedEffectString("Trade", 304, y + 152, 0xffffff, true);
  696.         client.smallFont.drawCenteredEffectString("Assist", 374, y + 152, 0xffffff, true);
  697.         client.smallFont.drawCenteredEffectString("On", 90, y + 163, 65280, true);
  698.         client.smallFont.drawCenteredEffectString("Disabled", 374, y + 163, 0xff0000, true);
  699.         client.smallFont.drawCenteredEffectString(text[client.publicChatMode], 147, y + 163, textColor[client.publicChatMode], true);
  700.         client.smallFont.drawCenteredEffectString(text[client.privateChatMode], 205, y + 163, textColor[client.privateChatMode], true);
  701.         client.smallFont.drawCenteredEffectString(text[client.clanChatMode], 260, y + 163, textColor[client.clanChatMode], true);
  702.         client.smallFont.drawCenteredEffectString(text[client.tradeMode], 318, y + 163, textColor[client.tradeMode], true);
  703.         //game.smallFont.drawCenteredString(374, y + 163, text[game.duelMode], tetColor[game.duelMode], true);
  704.     }
  705.  
  706.     /**
  707.      * Displays the orb.
  708.      *
  709.      * @param x
  710.      * @param y
  711.      * @param orb
  712.      * @param hover
  713.      */
  714.     private void displayOrb(int x, int y, int orb, boolean hover) {
  715.         client.cacheSprite[hover && client.mouseInRegion(x, y, x + 57, y + 33) ? 51 : 50].drawImage(x, y);
  716.         client.smallFont.drawCenteredEffectString(OrbHandler.getValue(orb), x + 15, y + 26, OrbHandler.getColor(orb), true);
  717.         client.cacheSprite[56 + orb].drawImage(x + 27, y + 3);
  718.         Rasterizer2D.setClip(x + 27, y + 3, x + 58, y + 3 + OrbHandler.getFill(orb, 27));
  719.         client.cacheSprite[60].drawImage(x + 27, y + 3);
  720.         Rasterizer2D.removeClip();
  721.         if(orb != Constants.ORB_HEALTH || OrbHandler.getPercent(orb) > 20 || OrbHandler.getPercent(orb) < 1 || client.loopCycle % 20 > 10) {
  722.             client.cacheSprite[61 + orb].drawImage(x + 41 - client.cacheSprite[61 + orb].imageWidth / 2, y + 17 - client.cacheSprite[61 + orb].imageHeight / 2);
  723.         }
  724.     }
  725. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement