Commit 11a6b97a authored by Marwolf's avatar Marwolf 💬

Synchronizes Android with PC client

parent 04f1118e
......@@ -96,12 +96,12 @@ public class Sprite {
public int getID() {
return id;
}
public void setID(int id) { this.id = id; }
public void setID(int id) { this.id = id; }
public String getPackageName() {
return packageName;
}
public void setPackageName(String name) { this.packageName = name; }
public void setPackageName(String name) { this.packageName = name; }
public void setShift(int xShift, int yShift) {
this.xShift = xShift;
......@@ -119,12 +119,10 @@ public class Sprite {
public int getXShift() {
return xShift;
}
public void setXShift(int value) { this.xShift = value; }
public void setXShift(int value) { this.xShift = value; }
public int getYShift() {
return yShift;
}
public void setYShift(int value) { this.yShift = value; }
public int getYShift() { return yShift; }
public void setYShift(int value) { this.yShift = value; }
public int[] getPixels() {
return pixels;
......
package com.openrsc.interfaces;
import orsc.graphics.two.GraphicsController;
import orsc.mudclient;
import java.util.ArrayList;
import java.util.HashMap;
import orsc.graphics.two.GraphicsController;
import orsc.mudclient;
public class NComponent {
public int x;
......@@ -183,7 +183,7 @@ public class NComponent {
if (drawBorder)
graphics().drawBoxBorder(drawX, width, drawY, height, !isHovered() ? borderColor : borderColorHovered);
if (drawSprite) {
//graphics().drawSpriteClipping(spriteID, drawX, drawY, spriteWidth, spriteHeight, spriteOverlay, 0, false, 0, 1);
//graphics().drawSpriteClipping(spriteID, drawX, drawY, spriteWidth, spriteHeight, spriteOverlay, 0, false, 0, 1);
}
if (drawHorizLine) {
graphics().drawLineHoriz(drawX, drawY, horizWidth, horizColor);
......
......@@ -5,32 +5,32 @@ import orsc.Config;
import orsc.graphics.gui.Panel;
import orsc.graphics.two.GraphicsController;
import orsc.mudclient;
public final class AchievementGUI {
public Panel achievementPanel;
private int x, y;
private int width, height;
private int achievementID = -1;
private boolean visible;
private mudclient mc;
public Panel achievementPanel;
public AchievementGUI(mudclient mc) {
this.mc = mc;
width = 375;
height = 246 - 25;
x = (mc.getGameWidth() / 2) - width;
y = (mc.getGameHeight() / 2) - height;
achievementPanel = new Panel(mc.getSurface(), 5);
}
public void reposition() {
x = (mc.getGameWidth() - width) / 2;
y = (mc.getGameHeight() - height) / 2;
}
public boolean onRender(GraphicsController graphics) {
reposition();
int boxColor = 0x989898;
......@@ -40,33 +40,33 @@ public final class AchievementGUI {
//(mc.achievementProgress[getAchievement()] == 2 ? "@gre@" : "@yel@") + mc.achievementNames[getAchievement()]
graphics.drawBox(x, y, width, 15, headerColor);
graphics.drawColoredStringCentered(width / 2 + x, "Achievement:" + (mc.achievementProgress[getAchievement()] == 2 ? "@gre@ Completed" : ""), 16777215, 0, 1, y + 12);
// CONTENT
graphics.drawBoxAlpha(x, y + 15, width, height, boxColor, 160);
graphics.drawColoredStringCentered(width / 2 + x, (mc.achievementProgress[getAchievement()] == 2 ? "@gre@" : "@yel@") + mc.achievementNames[getAchievement()], 16777215, 0, 5, y + 36);
graphics.drawWrappedCenteredString(mc.achievementDescs[getAchievement()], width / 2 + x, y + 55, width - 14, 1, textColor, true);
graphics.drawString("Rewards: ", x + 6, y + 135, textColor, 1);
graphics.drawString((mc.achievementProgress[getAchievement()] == 2 ? "@gr2@Congratulations! " + (Config.isAndroid() ? "tap" : "click") + " on each box to claim your rewards." : "@or1@You have not completed your achievement yet."), x + 63, y + 135, textColor, 0);
//(mc.achievementProgress[getAchievement()] == 2 ? "@gre@" : "@yel@")
int rewardBoxX = 0;
int rewardBoxY = y + 143;
for(int box = 0; box < 12; box++) {
for (int box = 0; box < 12; box++) {
int sizeX = 48;
int sizeY = 34;
graphics.drawBoxAlpha(rewardBoxX + 74, rewardBoxY, sizeX, sizeY, boxColor, 160);
graphics.drawBoxBorder(rewardBoxX + 74 - 1, sizeX + 2, rewardBoxY - 1, sizeY + 2, 0);
//rewardBox.setSprite(2150 + 130, 48, 32, 0);
graphics.drawSpriteClipping(mc.spriteSelect(EntityHandler.getItemDef(30)), rewardBoxX + 74, rewardBoxY, 48, 32, 0, 0, false, 0,1);
graphics.drawSpriteClipping(mc.spriteSelect(EntityHandler.getItemDef(30)), rewardBoxX + 74, rewardBoxY, 48, 32, 0, 0, false, 0, 1);
rewardBoxX += sizeX + 15;
if(rewardBoxX + sizeX > this.width) {
if (rewardBoxX + sizeX > this.width) {
rewardBoxY += sizeY + 15;
rewardBoxX = 0;
}
}
// CLOSE FOOTER
drawButton(graphics, x, height + 71, 375, 25, (Config.isAndroid() ? "Tap here to close" : "Click left mouse button to close"), false, new ButtonHandler() {
@Override
......@@ -75,10 +75,10 @@ public final class AchievementGUI {
hide();
}
});
return true;
}
public boolean isVisible() {
return visible;
}
......@@ -86,31 +86,31 @@ public final class AchievementGUI {
public void setVisible(boolean visible) {
this.visible = visible;
}
public void show() {
setVisible(true);
}
public void hide() {
setVisible(false);
}
private int getAchievement() {
return achievementID;
}
public void setAchievement(int i) {
this.achievementID = i;
}
private void drawButton(GraphicsController graphics, int x, int y, int width, int height, String text,
boolean checked, ButtonHandler handler) {
boolean checked, ButtonHandler handler) {
int allColor = 0x313439;
if (checked) {
allColor = 0x659CDE;
}
if (mc.getMouseX() >= x && mc.getMouseY() >= y && mc.getMouseX() <= x + width && mc.getMouseY() <= y + height) {
if(!checked)
if (!checked)
allColor = 0x263751;
if (mc.getMouseClick() == 1) {
handler.handle();
......
......@@ -212,11 +212,11 @@ public final class AuctionHouse {
} else if (newAuctionItem != null) {
ItemDef def = EntityHandler.getItemDef(newAuctionItem.getItemID());
mc.getSurface().drawSpriteClipping(mc.spriteSelect(def), x + 40, y + 55, 48, 32,
def.getPictureMask(), 0, false, 0, 1);
def.getPictureMask(), 0, false, 0, 1);
if (def.getNotedFormOf() >= 0) {
ItemDef originalDef = EntityHandler.getItemDef(def.getNotedFormOf());
mc.getSurface().drawSpriteClipping(mc.spriteSelect(originalDef), x + 47,
y + 59, 33, 23, originalDef.getPictureMask(), 0, false, 0, 1);
y + 59, 33, 23, originalDef.getPictureMask(), 0, false, 0, 1);
}
//graphics.drawString("Fee: +" + (int) getFee() + "gp", x + 6, y + 101, 0xffffff, 0);
}
......@@ -280,24 +280,24 @@ public final class AuctionHouse {
ItemDef def = EntityHandler.getItemDef(mc.getInventoryItems()[inventorySlot]);
mc.getSurface().drawSpriteClipping(mc.spriteSelect(def), drawX, drawY, 48,
32, def.getPictureMask(), 0, false, 0, 1);
32, def.getPictureMask(), 0, false, 0, 1);
if (def.getNotedFormOf() >= 0) {
ItemDef originalDef = EntityHandler.getItemDef(def.getNotedFormOf());
mc.getSurface().drawSpriteClipping(mc.spriteSelect(originalDef), drawX + 7,
drawY + 4, 33, 23, originalDef.getPictureMask(), 0, false, 0, 1);
drawY + 4, 33, 23, originalDef.getPictureMask(), 0, false, 0, 1);
}
graphics.drawString(String.valueOf(mc.getInventoryItemsCount()[inventorySlot]), drawX + 1,
drawY + 10, 65280, 1);
drawY + 10, 65280, 1);
}
if (mc.getMouseX() > drawX && mc.getMouseX() < drawX + boxWidth && mc.getMouseY() > drawY
&& mc.getMouseY() < drawY + boxHeight) {
&& mc.getMouseY() < drawY + boxHeight) {
graphics.drawBoxAlpha(drawX, drawY, boxWidth, boxHeight, i7, 160);
if (mc.getMouseClick() == 1) {
int itemID = mc.getInventoryItems()[inventorySlot];
int amount = mc.getInventoryCount(itemID);
if (itemID == 10 || EntityHandler.getItemDef(itemID).quest) {
mc.showMessage(false, null, "This object cannot be added to auction", MessageType.GAME,
0, null);
0, null);
return;
}
if (amount > 0) {
......@@ -360,7 +360,7 @@ public final class AuctionHouse {
continue;
AuctionItem ahItem = filteredList.get(i);
if (mc.getMouseX() >= listX - 72 && mc.getMouseY() >= listY - 11 && mc.getMouseX() <= listX + 275 - 12
&& mc.getMouseY() <= listY - 11 + boxHeight) {
&& mc.getMouseY() <= listY - 11 + boxHeight) {
graphics.drawBoxAlpha(listX - 72, listY - 11, 348, boxHeight, 0x980000, 128);
if (mc.getMouseClick() == 1) {
selectedCancelAuction = i;
......@@ -395,7 +395,7 @@ public final class AuctionHouse {
graphics.drawBoxAlpha(listX - 72, listY - 10, boxWidth + 1, boxHeight - 1, 0xfffffff, 128);
mc.getSurface().drawSpriteClipping(mc.spriteSelect(def), listX - 72, listY - 10, 48,
32, def.getPictureMask(), 0, false, 0, 1);
32, def.getPictureMask(), 0, false, 0, 1);
graphics.drawString(String.valueOf(ahItem.getAmount()), listX - 72 + 1, listY - 10 + 11, 65280, 3);
listY += boxHeight + 2;
......@@ -405,7 +405,7 @@ public final class AuctionHouse {
int cancelAuctionColor = 0x980000;
if (mc.getMouseX() >= x + 285 - 29 && mc.getMouseY() >= y + 260 && mc.getMouseX() <= x + 385 - 17
&& mc.getMouseY() <= y + 20 + 260) {
&& mc.getMouseY() <= y + 20 + 260) {
cancelAuctionColor = 0x500000;
if (mc.getMouseClick() == 1 && selectedCancelAuction < filteredList.size()) {
sendCancelAuction(filteredList.get(selectedCancelAuction).getAuctionID());
......@@ -659,7 +659,7 @@ public final class AuctionHouse {
} else if (selectedFilter == 5) {
nameFilter = new String[]{"uncut", "sapphire", "emerald", "ruby", "diamond", "dragonstone"};
exactNameFilter = new String[]{"opal", "jade", "amulet of accuracy", "gold amulet", "brass necklace",
"gold necklace", "holy symbol of saradomin", "unblessed holy symbol"};
"gold necklace", "holy symbol of saradomin", "unblessed holy symbol"};
} else if (selectedFilter == 6) {
nameFilter = new String[]{" ore", "coal", "bar", "clay"};
exactNameFilter = new String[]{"gold", "silver", "silver certificate", "gold certificate"};
......@@ -667,8 +667,8 @@ public final class AuctionHouse {
commandFilter = new String[]{"identify"};
nameFilter = new String[]{"unfinished", "vial", "weed", "ground", "root", "scale"};
exactNameFilter = new String[]{"Guam Leaf", "Marrentill", "Tarromin", "Harralander", "Irit leaf",
"Avantoe", "Kwuarm", "Cadantine", "Torstol", "Pestle and mortar", "Eye of newt", "Jangerberries",
"Red spiders eggs", "White berries", "Snape grass", "Wine of zamorak"};
"Avantoe", "Kwuarm", "Cadantine", "Torstol", "Pestle and mortar", "Eye of newt", "Jangerberries",
"Red spiders eggs", "White berries", "Snape grass", "Wine of zamorak"};
} else if (selectedFilter == 8) {
nameFilter = new String[]{"halloween", "bunny", "party", "pumpkin", "easter", "scythe", "cracker"};
exactNameFilter = new String[]{"Disc of returning", "santa's hat"};
......@@ -676,14 +676,14 @@ public final class AuctionHouse {
if (selectedFilter == 9) {
nameFilter = resources;
exactNameFilter = new String[]{
"fur", "leather", "wool", "bow string", "flax", "cow hide",
"knife", "egg", "bucket", "milk", "flour", "skull", "grain",
"needle", "thread", "holy", "water", "cadavaberries",
"pot", "jug", "grapes", "shears", "tinderbox",
"chisel", "hammer", "ashes", "apron", "chef's hat", "skirt", "silk",
"flier", "garlic", "redberries", "rope", "bad wine", "cape",
"eye of newt", "lobster pot", "net", "fishing rod", "fly fishing rod", "harpoon",
"fishing bait", "feather"
"fur", "leather", "wool", "bow string", "flax", "cow hide",
"knife", "egg", "bucket", "milk", "flour", "skull", "grain",
"needle", "thread", "holy", "water", "cadavaberries",
"pot", "jug", "grapes", "shears", "tinderbox",
"chisel", "hammer", "ashes", "apron", "chef's hat", "skirt", "silk",
"flier", "garlic", "redberries", "rope", "bad wine", "cape",
"eye of newt", "lobster pot", "net", "fishing rod", "fly fishing rod", "harpoon",
"fishing bait", "feather"
};
}
boolean skip = true;
......@@ -756,7 +756,7 @@ public final class AuctionHouse {
continue;
AuctionItem ahItem = filteredList.get(i);
if (mc.getMouseX() >= (listX - 3) && mc.getMouseY() >= (listY - 5) && mc.getMouseX() <= listX + 384
&& mc.getMouseY() <= (listY - 5) + boxHeight) {
&& mc.getMouseY() <= (listY - 5) + boxHeight) {
graphics.drawBoxAlpha(listX - 3, listY - 5, 400, boxHeight, 0x980000, 128);
if (mc.getMouseClick() == 1) {
selectedAuction = i;
......@@ -786,13 +786,13 @@ public final class AuctionHouse {
graphics.drawBoxAlpha(listX - 3, listY - 4, boxWidth + 1, boxHeight - 1, 0xfffffff, 128);
mc.getSurface().drawSpriteClipping(mc.spriteSelect(def), listX - 3, listY - 5, 48,
32, def.getPictureMask(), 0, false, 0, 1);
32, def.getPictureMask(), 0, false, 0, 1);
graphics.drawString(String.valueOf(ahItem.getAmount()), listX + 1 - 3, listY + 10 - 4, 65280, 1);
listY += boxHeight + 2;
}
graphics.drawString("Showing: " + (showing) + "/" + (filteredList.size()) + " items", listX + 49, y + 75,
0xffffff, 1);
0xffffff, 1);
graphics.drawString("Expires in", listX + 201, y + 75, 0xffffff, 1);
}
......@@ -834,7 +834,7 @@ public final class AuctionHouse {
graphics.drawBoxBorder(selectX + 8, 50, selectY + 22, 34, 0);
mc.getSurface().drawSpriteClipping(mc.spriteSelect(def), selectX + 8, selectY + 22, 48, 32,
def.getPictureMask(), 0, false, 0, 1);
def.getPictureMask(), 0, false, 0, 1);
graphics.drawString(String.valueOf(ahItem.getAmount()), selectX + 10, selectY + 22 + 11, 65280, 1);
graphics.drawString(getTime(ahItem) + "h left", selectX + 60, selectY + 32, 0xffffff, 2);
......@@ -987,7 +987,7 @@ public final class AuctionHouse {
}
} else if (activeInterface == 1) {
if (myAuctions.focusOn(textField_amount) || myAuctions.focusOn(textField_price)
|| myAuctions.focusOn(textField_priceEach)) {
|| myAuctions.focusOn(textField_priceEach)) {
if (newAuctionItem != null) {
if (key >= 48 && key <= 57 || key == 8) {
myAuctions.keyPress(key);
......
......@@ -7,15 +7,15 @@ import orsc.graphics.two.GraphicsController;
import orsc.mudclient;
public final class IronManInterface {
public Panel ironmanPanel;
public int iron_man_mode = 0;
public int iron_man_restriction = 0;
private int x, y;
private int width, height;
private boolean deactivationMenu = false;
private boolean visible;
private mudclient mc;
public Panel ironmanPanel;
private String[] ironManTitle = { "Standard Iron Man", "Hardcore Iron Man", "Ultimate Iron Man", "None" };
private String[] ironManTitle = {"Standard Iron Man", "Hardcore Iron Man", "Ultimate Iron Man", "None"};
private String[] ironManDescription =
{
"An Iron Man cannot trade, stake, receive PK loot, scavenge dropped items, nor play certain multiplayer minigames.",
......@@ -23,17 +23,26 @@ public final class IronManInterface {
"In addition to the standard Iron Man rules, an Ultimate Iron Man cannot use banks, nor retain any items on death in dangerous areas.",
"- No Iron Man restrictions will apply to this account."
};
private String[] restrictionTitle = { "PIN", "Permanent" };
private String[] restrictionTitle = {"PIN", "Permanent"};
private String[] restrictionDesc =
{
"You must enter your Bank Pin to request that Iron Man restrictions be removed.",
"- The Iron Man restrictions can never be removed."
};
private int[] order = {3, 0, 2, 1};
private int[] selectMode = {1, 3, 2, 0};
private int[] order = { 3, 0, 2, 1 };
private int[] selectMode = { 1, 3, 2, 0 };
public IronManInterface(mudclient mc) {
this.mc = mc;
width = 480;
height = 265;
x = (mc.getGameWidth() / 2) - width;
y = (mc.getGameHeight() / 2) - height;
ironmanPanel = new Panel(mc.getSurface(), 1);
}
private String getIronManTitleByID(int id) {
return ironManTitle[id];
......@@ -51,19 +60,6 @@ public final class IronManInterface {
return restrictionDesc[id];
}
public IronManInterface(mudclient mc) {
this.mc = mc;
width = 480;
height = 265;
x = (mc.getGameWidth() / 2) - width;
y = (mc.getGameHeight() / 2) - height;
ironmanPanel = new Panel(mc.getSurface(), 1);
}
public void reposition() {
x = (mc.getGameWidth() - width) / 2;
y = (mc.getGameHeight() - height) / 2;
......@@ -72,7 +68,7 @@ public final class IronManInterface {
public boolean onRender(GraphicsController graphics) {
reposition();
drawIronmanInterface(graphics);
if(deactivationMenu) {
if (deactivationMenu) {
drawDeactivationMenu(graphics);
}
return true;
......@@ -115,7 +111,7 @@ public final class IronManInterface {
drawCloseButton(graphics, x + 457, y + 2, 21, 21, "X", new ButtonHandler() {
@Override
void handle() {
if(!deactivationMenu) {
if (!deactivationMenu) {
setVisible(false);
}
}
......@@ -128,21 +124,21 @@ public final class IronManInterface {
int titleY = 18;
int descX = 21;
int descY = 11;
for(int i = 0; i < 4; i++) {
for (int i = 0; i < 4; i++) {
final int modeID = i;
if(modeID == 1) {
if (modeID == 1) {
drawBoxheight = 45;
drawBoxY += 50;
circleY += 50;
titleY -= 8;
descX -= 1;
} else if(modeID == 2) {
} else if (modeID == 2) {
drawBoxheight = 45;
drawBoxY += 45;
circleY += 43;
titleY += 5;
descX += 0;
} else if(modeID == 3) {
} else if (modeID == 3) {
drawBoxheight = 20;
drawBoxY += 45;
circleY += 33;
......@@ -162,7 +158,7 @@ public final class IronManInterface {
});
graphics.drawCircle(drawBoxX + 8 + 5, circleY, 8, 0x3A3026, 255, 0);
if(i == order[iron_man_mode]) {
if (i == order[iron_man_mode]) {
graphics.drawSpriteClipping(mc.spriteSelect(EntityHandler.GUIparts.get(EntityHandler.GUIPARTS.CHECKMARK.id())), drawBoxX + 8, circleY - 5, 13, 10, 0, 0, false, 0, 1);
}
}
......@@ -170,14 +166,14 @@ public final class IronManInterface {
drawClickBox(graphics, drawBoxX + 5, drawBoxY + 58, 250, 222, 34, " Deactivation settings", titleY - 3, "Set restrictions on deactivating or downgrading your Iron Man status.", descX - 5, descY + 10, new ButtonHandler() {
@Override
void handle() {
if(getIronManMode() >= 1 && getIronManMode() <= 3) {
if (getIronManMode() >= 1 && getIronManMode() <= 3) {
deactivationMenu = true;
}
}
});
//graphics.drawSpriteClipping(2340, drawBoxX + 8, circleY + 21, 48, 32, 0, 0, false, 0, 1);
if(deactivationMenu)
if (deactivationMenu)
graphics.drawBoxAlpha(x, y, width, height, 0, 192);
}
......@@ -202,7 +198,7 @@ public final class IronManInterface {
int titleY = 11;
int descX = 21;
int descY = 11;
for(int i = 0; i < 2; i++) {
for (int i = 0; i < 2; i++) {
final int restrictionID = i;
drawClickRestrictionBox(graphics, drawBoxX + 5, drawBoxY + 26, drawBoxWidth, 340, drawBoxheight, getIronManRestrictionByID(restrictionID), titleY, getIronManRestrictionDescByID(restrictionID), descX - 1, descY, new ButtonHandler() {
@Override
......@@ -216,7 +212,7 @@ public final class IronManInterface {
}
});
graphics.drawCircle(drawBoxX + 8 + 5, circleY, 8, 0x3A3026, 255, 0);
if(i == this.iron_man_restriction) {
if (i == this.iron_man_restriction) {
graphics.drawSpriteClipping(mc.spriteSelect(EntityHandler.GUIparts.get(EntityHandler.GUIPARTS.CHECKMARK.id())), drawBoxX + 8, circleY - 5, 13, 10, 0, 0, false, 0, 1);
}
drawBoxheight = 20;
......@@ -224,13 +220,10 @@ public final class IronManInterface {
circleY += 36;
titleY += 3;
descY = 0;
descX += 55 ;
descX += 55;
}
}
public int iron_man_mode = 0;
public int iron_man_restriction = 0;
public int getIronManMode() {
return iron_man_mode;
}
......@@ -245,10 +238,10 @@ public final class IronManInterface {
}
public void updateMode(int i) {
if(getIronManMode() <= 0 || getIronManMode() >= 4) {
if (getIronManMode() <= 0 || getIronManMode() >= 4) {
return;
}
if(i > 1 || i < 0) {
if (i > 1 || i < 0) {
i = 0;
}
mc.packetHandler.getClientStream().newPacket(199);
......
......@@ -14,21 +14,14 @@ import orsc.mudclient;
public final class LostOnDeathInterface {
public Panel lostOnDeathPanel;
int itemSelected = -1, rightClickMenuX = 0, rightClickMenuY = 0;
int width = 509;
int height = 331;
private ArrayList<OnDeathItem> onDeathItems;
private boolean visible;
int itemSelected = -1, rightClickMenuX = 0, rightClickMenuY = 0;
public Panel lostOnDeathPanel;
private mudclient mc;
private int panelColour, textColour, bordColour;
int width = 509;
int height = 331;
private int x, y;
public LostOnDeathInterface(mudclient mc) {
......@@ -50,7 +43,9 @@ public final class LostOnDeathInterface {
public void onRender() {
reposition();
panelColour = 0x989898; textColour = 0xFFFFFF; bordColour = 0x000000;
panelColour = 0x989898;
textColour = 0xFFFFFF;
bordColour = 0x000000;
lostOnDeathPanel.handleMouse(mc.getMouseX(), mc.getMouseY(), mc.getMouseButtonDown(), mc.getLastMouseDown());
......@@ -134,7 +129,8 @@ public final class LostOnDeathInterface {
private void populateOnDeathItems() {
int[] invyItems = mc.getInventoryItems();
for (int i = 0; i < mc.getInventoryItemCount(); i++) {int count = mc.getInventoryItemCount();
for (int i = 0; i < mc.getInventoryItemCount(); i++) {
int count = mc.getInventoryItemCount();
if (invyItems[i] > 0) {
ItemDef def = EntityHandler.getItemDef(invyItems[i]);
int stackCount = 1;
......@@ -169,7 +165,7 @@ public final class LostOnDeathInterface {
// Handles special case of stackable items being kept
if (EntityHandler.getItemDef(onDeathItems.get(i).getItemID()).isStackable()) {
onDeathItems.add(i, new OnDeathItem(onDeathItems.get(i).getItemID(), onDeathItems.get(i).getPrice(), 1, false));
onDeathItems.set(i+1, new OnDeathItem(onDeathItems.get(i+1).getItemID(), onDeathItems.get(i+1).getPrice(), onDeathItems.get(i+1).getStackCount() - 1, false));
onDeathItems.set(i + 1, new OnDeathItem(onDeathItems.get(i + 1).getItemID(), onDeathItems.get(i + 1).getPrice(), onDeathItems.get(i + 1).getStackCount() - 1, false));
}
onDeathItems.get(i).setLost(true);
}
......@@ -185,7 +181,7 @@ public final class LostOnDeathInterface {
for (int j = i + 1; j < keepXItems; j++) {
if (onDeathItems.get(i).getItemID() == onDeathItems.get(j).getItemID()) {
onDeathItems.set(i, new OnDeathItem(onDeathItems.get(i).getItemID(), onDeathItems.get(i).getPrice(), onDeathItems.get(i).getStackCount() + 1, onDeathItems.get(i).getLost()));
onDeathItems.remove(i+1);
onDeathItems.remove(i + 1);
}
}
}
......@@ -208,7 +204,7 @@ public final class LostOnDeathInterface {
public void drawStringCentered(String str, int x, int y, int font, int color) {
int stringWid = mc.getSurface().stringWidth(font, str);
mc.getSurface().drawString(str, x + (width/2) - (stringWid/2) - 2, y, color, font);
mc.getSurface().drawString(str, x + (width / 2) - (stringWid / 2) - 2, y, color, font);
}
private void drawButton(int x, int y, int width, int height, String text, int font, boolean checked, ButtonHandler handler) {
......@@ -226,7 +222,7 @@ public final class LostOnDeathInterface {
}
mc.getSurface().drawBoxAlpha(x, y, width, height, bgBtnColour, 192);
mc.getSurface().drawBoxBorder(x, width, y, height, 0x242424);
mc.getSurface().drawString(text, x + (width/2) - (mc.getSurface().stringWidth(font, text)/2) - 1, y + height / 2 + 5, textColour, font);
mc.getSurface().drawString(text, x + (width / 2) - (mc.getSurface().stringWidth(font, text) / 2) - 1, y + height / 2 + 5, textColour, font);
}
public boolean isVisible() {
......
......@@ -2,36 +2,28 @@ package com.openrsc.interfaces.misc;
import com.openrsc.client.entityhandling.EntityHandler;
import com.openrsc.client.entityhandling.defs.ItemDef;
import java.util.ArrayList;
import orsc.graphics.gui.Panel;
import orsc.graphics.two.GraphicsController;
import orsc.mudclient;
import java.util.ArrayList;
public final class SkillGuideInterface {
private ArrayList<SkillItem> skillItems;
public int curTab = 0;
private boolean visible = false;
public int skillGuideScroll;
public Panel skillGuide;
private mudclient mc;
private int panelColour, textColour, bordColour;
int width = 430;
int height = 320;
int autoHeight = 0;
private int x, y;