|
|||||||||||||||
|
|
#1 (permalink) |
|
Registered Member
![]() Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
bank rearrange [TUT]
Purpose: Fill your empty bank spots with the currently available items Difficulty: 1-10 Assumed Knowledge: C & P... Some logic thinking if you want to understand what i did Server Base: Pimp (all servers from winterlove? )Required integers: bankItems[x], bankItemsN[x], playerBankSize Required voids: openUpBank(); Classes Modified: client Procedure Step 1: Open your client.java Declare this void: Code:
public void rearrangeBank() { //this fills up the empty spots
int totalItems = 0;
int highestSlot = 0;
for (int i = 0; i < playerBankSize; i++) {
if (bankItems[i] != 0) {
totalItems ++;
if (highestSlot <= i) highestSlot = i;
} }
for (int i = 0; i <= highestSlot; i++) {
if (bankItems[i] == 0) {
boolean stop = false;
for (int k = i; k <= highestSlot; k++) {
if (bankItems[k] != 0 && !stop) {
int spots = k - i;
for (int j = k; j <= highestSlot; j++) {
bankItems[j-spots] = bankItems[j];
bankItemsN[j-spots] = bankItemsN[j];
stop = true;
bankItems[j] = 0; bankItemsN[j] = 0;
}
}
}
}
}
int totalItemsAfter = 0;
for (int i = 0; i < playerBankSize; i++) {
if (bankItems[i] != 0) { totalItemsAfter ++; } }
if (totalItems != totalItemsAfter) outStream.createFrame(109); //disconnects when duping
}
Place it above 'boolean process' Step 2: making it rearrange when the bank is opened search for: Code:
public void openUpBank Code:
rearrangeBank(); resetBank(); ![]() NOTE: i have been testing this for over 15 minuts Credits: 100% mine for ppl that haven't got the resetbank void: Code:
public void resetBank() {
outStream.createFrameVarSizeWord(53);
outStream.writeWord(5382); // bank
outStream.writeWord(playerBankSize); // number of items
for (int i = 0; i < playerBankSize; i++) {
if (bankItemsN[i] > 254) {
outStream.writeByte(255);
outStream.writeDWord_v2(bankItemsN[i]);
} else {
outStream.writeByte(bankItemsN[i]); //amount
}
if (bankItemsN[i] < 1)
bankItems[i] = 0;
if (bankItems[i] > 20000 || bankItems[i] < 0) {
bankItems[i] = 20000;
}
outStream.writeWordBigEndianA(bankItems[i]); // itemID
}
outStream.endFrameVarSizeWord();
}
|
|
|
|
|
#2 (permalink) | |
|
Registered Member
![]() Join Date: Dec 2007
Age: 22
Posts: 9,124
Thanks: 48
Thanked 425 Times in 228 Posts
Rep Power: 4011 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
wouldnt it just have been easier to tell us the line/s you changed?
good work none the less.
__________________
Inactive for the forseeable future .LEGIT Rune-Server top poster, Vastico's just a cheating cunt who buys post count and merges accounts that aren't his. Quote:
|
|
|
|
|
|
#4 (permalink) |
|
Registered Member
![]() Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
@ Luke: i did not change any lines :P just made a whole new void..
@ Called Enzo: This is not the 'rearrange' option in your bank interface. This is just the empty spot refiller. |
|
|
![]() |
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|