Real B.o.B. Interface Client/Server Sided
The only problem with this, is the fact that they are all positioned to the left a little bit, but other than that, its 100% correct. No glitches/dupes neither.
My first tutorial so don't hate :D
Client Sided Credits 95% Harlan, 5% Me For fixing some of the positioning.
Server Sided - 100% Me
Download this and just put it in sprites: [Only registered and activated users can see links. Click Here To Register...]
Picture of what you are adding :D
[Only registered and activated users can see links. Click Here To Register...]
CLIENT SIDED
Go to RsInterface.java, and add these 2:
Code:
public static void addBobStorage(int index) {
RSInterface rsi = interfaceCache[index] = new RSInterface();
rsi.actions = new String[10];
rsi.spritesX = new int[20];
rsi.invStackSizes = new int[30];
rsi.inv = new int[30];
rsi.spritesY = new int[20];
rsi.children = new int[0];
rsi.childX = new int[0];
rsi.childY = new int[0];
rsi.actions[0] = "Take 1";
rsi.actions[1] = "Take 5";
rsi.actions[2] = "Take 10";
rsi.actions[3] = "Take All";
rsi.actions[4] = "Take X";
rsi.centerText = true;
rsi.aBoolean227 = false;
rsi.aBoolean235 = false;
rsi.usableItemInterface = false;
rsi.isInventoryInterface = false;
rsi.aBoolean259 = true;
rsi.textShadow = false;
rsi.invSpritePadX = 22;
rsi.invSpritePadY = 21;
rsi.height = 5;
rsi.width = 6;
rsi.parentID = 2702;
rsi.id = 2700;
rsi.type = 2;
}
public static void bobInterface(TextDrawingArea[] tda) {
RSInterface rsi = addTabInterface(2700);
addSprite(2701, 0, "BoB/SPRITE");
addBobStorage(2702);
addHoverButton(2703, "Interfaces/Equipment/SPRITE", 1, 21, 21, "Close", 250, 2704, 3);
addHoveredButton(2704, "Interfaces/Equipment/SPRITE", 3, 21, 21, 2705);
rsi.totalChildren(4);
rsi.child(0, 2701, 90, 14);
rsi.child(1, 2702, 100, 56);
rsi.child(2, 2703, 431, 23);
rsi.child(3, 2704, 431, 23);
}
Then find:
Code:
friendsTab(atextdrawingarea);
Under that put:
Code:
bobInterface(atextdrawingarea);
SERVER SIDED:
In summoning.java, replace your store method with:
Code:
public void store() {
for (int k = 0; k < 30; k++) {
if(c.bobItems[k] > 0) {
c.getPA().Frame34(2702, c.bobItems[k], k, c.bobItemsN[k]);
}
if(c.bobItems[k] <= 0) {
c.getPA().Frame34(2702, -1, k, c.bobItemsN[k]);
}
}
c.getPA().refreshBoB();
c.isBanking = false;
c.usingBoB = true;
c.getItems().resetItems(5064);
c.getItems().resetTempItems();
c.getOutStream().createFrame(248);
c.getOutStream().writeWordA(2700);
c.getOutStream().writeWord(5063);
c.getPA().sendFrame87(286, 0);
c.flushOutStream();
c.ResetKeepItems();
}
In RemoveItem.java Search for:
Under that case, put
Code:
case 2700: // Real bob interface
if (c.usingBoB) {
c.getPA().takeFromBoB(removeSlot, 1);
}
break;
In BankX2.java under
Code:
switch (c.xInterfaceId) {
Put
Code:
case 2700:
if (c.usingBoB) {
c.getPA().takeFromBoB(c.xRemoveSlot, Xamount);
}
break;
In BankAll.java under
Code:
switch(interfaceId){
Put:
Code:
case 2700:
if (c.usingBoB) {
c.getPA().takeFromBoB(removeSlot, c.bobSlotCount);
}
break;
In Bank10.java. Under case
Put
Code:
case 2700:
if (c.usingBoB) {
c.getPA().takeFromBoB(removeSlot, 10);
}
break;
In bank5.java, under the case
Put:
Code:
case 2700:
if (c.usingBoB) {
c.getPA().takeFromBoB(removeSlot, 5);
}
break;
Now in PlayerAssistant.java
Add this method:
Code:
public void refreshBoB() {
for (int k = 0; k < 30; k++) {
if (c.bobItems[k] > 0)
c.bobItemsN[k] = 1;
if(c.bobItems[k] > 0) {
Frame34(2702, c.bobItems[k], k, c.bobItemsN[k]);
}
if(c.bobItems[k] <= 0) {
Frame34(2702, -1, k, c.bobItemsN[k]);
}
}
c.getItems().resetItems(5064);
}
public void removeBoBItems(int slot, int amount) {
if (c.getItems().freeSlots() > 0) {
c.getItems().addItem(c.bobItems[slot], amount);
c.bobItemsN[slot] = 0;
c.bobItems[slot] = 0;
c.getItems().resetTempItems();
c.getItems().resetBank();
c.totalstored -= slot;
} else {
c.getItems().resetTempItems();
c.getItems().resetBank();
c.sendMessage("Not enough space in your inventory.");
return;
}
}
public void takeFromBoB(int slot, int amount) {
int itemId = c.bobItems[slot];
int invSlotCount = c.getItems().freeSlots();
if (amount > invSlotCount)
amount = invSlotCount;
if (invSlotCount < 1) {
c.sendMessage("Not enough inventory space.");
return;
}
bobWithdrawLoop(itemId, amount);
refreshBoB();
}
private void bobWithdrawLoop(int itemId, int amount) {
int inventoryAmount = 0;
for (int i = 0; i < c.bobItems.length; i++) {
if (c.bobItems[i] == itemId) {
inventoryAmount++;
if (inventoryAmount <= amount) {
c.getItems().addItem(itemId, c.bobItemsN[i]);
c.bobItems[i] = -1;
c.bobItemsN[i] = 0;
}
}
}
}
public void addToBoB(int slot, int amount) {
int itemId = c.playerItems[slot] - 1;
int invItemCount = c.getItems().getItemCount(itemId);
if (Item.itemStackable[itemId]) {
c.sendMessage("You cannot store stackable items!");
return;
}
if (amount > openSlots())
amount = openSlots();
if (amount > invItemCount)
amount = invItemCount;
if (!bobSlotsAvailable()) {
c.sendMessage("Your familiar's load is too heavy to add more items!");
return;
}
bobDepositLoop(itemId, amount);
refreshBoB();
}
private void bobDepositLoop(int itemId, int amount) {
int inventoryAmount = 0;
for (int i = 0; i < c.bobSlotCount; i++) {
if (c.bobItemsN[i] <= 0) {
inventoryAmount++;
if (inventoryAmount <= amount) {
c.getItems().deleteItem(itemId, c.getItems().getItemSlot(itemId), 1);
c.bobItems[i] = itemId;
c.bobItemsN[i] = 1;
}
}
}
}
public boolean bobSlotsAvailable() {
for (int i = 0; i < c.bobSlotCount; i++) {
if (c.bobItemsN[i] <= 0)
return true;
}
return false;
}
public int openSlots() {
int slotCount = 0;
for (int i = 0; i < c.bobSlotCount; i++) {
if (c.bobItemsN[i] <= 0)
slotCount++;
}
return slotCount;
}
In player.java
Add these:
Code:
public int bobSlotCount;
public boolean usingBoB;
public int[] bobItems, bobItemsN = new int[30];
Thanks everything. Post your errors below and I'll gladly help.
I know this has been released client sided, but I just included for the sake of the tutorial.
The reason I did this, were because I hate the old BoB Interface and custom interfaces with 28 not 30 spots.
Remember its my first tutorial :D