Rune-Server Did you know?
- The area within the walls of Falador covers an area of 9004 squares.
PortalForums Server TOP List New - PasteBin WebMail Register FAQ Members List Mark Forums Read
 

Server Top 5

Go Back   Rune-Server > RuneScape Development > RS2 Server > Tutorials


Closed Thread
 
LinkBack Thread Tools
Old 03-02-2008, 11:22 AM   #1 (permalink)
Registered Member
 
druidje's Avatar
 
Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57
druidje is a jewel in the rough
druidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the rough
[TUT] FULL bank rearrange (refilling, swapping, inserting)

I've decided to release full insert and swapping options...

Purpose: Fill your empty bank spots with the currently available items, Add fully working insert and swap option.

Difficulty: 2-10

Assumed Knowledge: Very basic Java

Server Base: All servers from winterlove?

Required integers: bankItems[x], bankItemsN[x], playerBankSize
Required voids: openUpBank(), moveItems()

Classes Modified: client

Procedure
Some of you may think that all sources already have full swapping, like I did... It works for some of your bankslots, but not all. This also fixes that bug.

Step 1:
If you haven't done my first tutorial for empty spot refilling:
http://www.rune-server.org/showthrea...498#post441498

Step 2: Open your client.java
Declare this under public class client extends Player implements Runnable:
Code:
public String bankRearrange = "swap";
Step 3:
Search for:
Code:
public void moveItems
In this void you will see:
Code:
if (moveWindow == 34453 && from >= 0 && to >= 0 && from < playerBankSize && to < playerBankSize) {
			int tempI;
			int tempN;
			tempI = bankItems[from];
			tempN = bankItemsN[from];

			bankItems[from] = bankItems[to];
			bankItemsN[from] = bankItemsN[to];
			bankItems[to] = tempI;
			bankItemsN[to] = tempN;
		}

		if (moveWindow == 34453) {
			resetBank();
		}
Replace that with:
Code:
if (moveWindow == 34453) {
		if (bankRearrange == "insert") {
				from -= 65280;
				if (to < 0) { int temp = 128 - (to*-1);
				to = 128 + temp; }
					}
		if (bankRearrange == "swap") {
				from = from;
				if (to < 0) { int temp = 128 - (to*-1);
				to = 128 + temp; }
					}
		if (from >= 0 && to >= 0 && from < playerBankSize && to < playerBankSize) {	
		
			if (bankRearrange != "insert") {
				int tempI = bankItems[from];
				int tempN = bankItemsN[from];

				bankItems[from] = bankItems[to];
				bankItemsN[from] = bankItemsN[to];
				bankItems[to] = tempI;
				bankItemsN[to] = tempN;
					}
			if (bankRearrange == "insert") {
				int tempItemFrom = bankItems[from];
				int tempNFrom = bankItemsN[from];
				int tempItemTo = bankItems[to];
				int tempNTo = bankItemsN[to];
				boolean gotSlot = false;

				
				int totalItems = 0;
				int highestSlot = 0;
					
					for (int i = 0; i < playerBankSize; i++) {
						if (bankItems[i] != 0) { 
							totalItems ++;
						if (highestSlot <= i) highestSlot = i;
								} }  
									
					bankItems[from] = 0;
					bankItemsN[from] = 0;
					
				if (from > to) {
					for (int i = from; i <= from && i >= to; i--) {
						if (i != to) {
						bankItems[i] = bankItems[i - 1];
						bankItemsN[i] = bankItemsN[i - 1];
							}
						
						if (i == to) {
							bankItems[i] = tempItemFrom;
							bankItemsN[i] = tempNFrom;
								}
							}
						}
						
				if (from < to) {
					for (int i = from; i >= from && i <= to; i++) {
						if (i != to) {
						bankItems[i] = bankItems[i + 1];
						bankItemsN[i] = bankItemsN[i + 1];
							}
						
						if (i == to) {
							bankItems[i] = tempItemFrom;
							bankItemsN[i] = tempNFrom;
								}
							}
						}
		
					int totalItemsAfter = 0;
						for (int i = 0; i < playerBankSize; i++) {
							if (bankItems[i] != 0) { totalItemsAfter ++; } }
		
						if (totalItems != totalItemsAfter) outStream.createFrame(109); //disconnects when duping. Just to be sure
				
								} resetBank();
							}
						}
Step 4:
Search for:
Code:
switch(actionButtonId)
Under the first { add:
Code:
/*banking [D]ruidje */
case 31195: //insert
bankRearrange = "insert";
break;
case 31194: //swap
bankRearrange = "swap";
break;
Step 4:
Search for:
Code:
public void initialize()
Under the first { add:
Code:
		//banking
		setconfig(304, 0); //sets to swap
		setconfig(115, 0); //sets to item
If you dont have the setconfig method...
declare this: (NOT mine)
Code:
public void setconfig(int settingID, int value) {	
		cframe(36);
		outStream.writeWordBigEndian(settingID);
		outStream.writeByte(value);
	}

FOLLOW THIS IF YOU DON'T HAVE A moveItems void:
declare this void:
Code:
public void moveItems(int from, int to, int moveWindow) {

	if (moveWindow == 34453) {
		if (bankRearrange == "insert") {
				from -= 65280;
				if (to < 0) { int temp = 128 - (to*-1);
				to = 128 + temp; }
					}
		if (bankRearrange == "swap") {
				from = from;
				if (to < 0) { int temp = 128 - (to*-1);
				to = 128 + temp; }
					}
		if (from >= 0 && to >= 0 && from < playerBankSize && to < playerBankSize) {	
		
			if (bankRearrange != "insert") {
				int tempI = bankItems[from];
				int tempN = bankItemsN[from];

				bankItems[from] = bankItems[to];
				bankItemsN[from] = bankItemsN[to];
				bankItems[to] = tempI;
				bankItemsN[to] = tempN;
					}
			if (bankRearrange == "insert") {
				int tempItemFrom = bankItems[from];
				int tempNFrom = bankItemsN[from];
				int tempItemTo = bankItems[to];
				int tempNTo = bankItemsN[to];
				boolean gotSlot = false;

				
				int totalItems = 0;
				int highestSlot = 0;
					
					for (int i = 0; i < playerBankSize; i++) {
						if (bankItems[i] != 0) { 
							totalItems ++;
						if (highestSlot <= i) highestSlot = i;
								} }  
									
					bankItems[from] = 0;
					bankItemsN[from] = 0;
					
				if (from > to) {
					for (int i = from; i <= from && i >= to; i--) {
						if (i != to) {
						bankItems[i] = bankItems[i - 1];
						bankItemsN[i] = bankItemsN[i - 1];
							}
						
						if (i == to) {
							bankItems[i] = tempItemFrom;
							bankItemsN[i] = tempNFrom;
								}
							}
						}
						
				if (from < to) {
					for (int i = from; i >= from && i <= to; i++) {
						if (i != to) {
						bankItems[i] = bankItems[i + 1];
						bankItemsN[i] = bankItemsN[i + 1];
							}
						
						if (i == to) {
							bankItems[i] = tempItemFrom;
							bankItemsN[i] = tempNFrom;
								}
							}
						}
		
					int totalItemsAfter = 0;
						for (int i = 0; i < playerBankSize; i++) {
							if (bankItems[i] != 0) { totalItemsAfter ++; } }
		
						if (totalItems != totalItemsAfter) outStream.createFrame(109); //disconnects when duping. Just to be sure
				
								} resetBank();
							}
						}
						
					}
Then search for:
Code:
case 214:	// change item places
You will see this:
Code:
				somejunk = inStream.readUnsignedWordA(); //junk
				int itemFrom = inStream.readUnsignedWordA();// slot1
				int itemTo = (inStream.readUnsignedWordA() - 128);// slot2
Under it add:
Code:
moveItems(itemFrom, itemTo, somejunk);
And your done
Post any errors.

Credits: 99% by me (don't know who made the setconfig method )
__________________

Quote:
Originally Posted by zee_best View Post
Get sarah101 to sleep with kevin?
Quote:
Originally Posted by ject View Post
but try ::noclit or whatever
Developing 508!
druidje is offline  
Old 03-02-2008, 11:25 AM   #2 (permalink)
Registered Member
 
druidje's Avatar
 
Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57
druidje is a jewel in the rough
druidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the rough
Thanks (too short)
__________________

Quote:
Originally Posted by zee_best View Post
Get sarah101 to sleep with kevin?
Quote:
Originally Posted by ject View Post
but try ::noclit or whatever
Developing 508!
druidje is offline  
Old 03-02-2008, 11:37 AM   #3 (permalink)
Ian...
Guest
 
Posts: n/a
Nice, Ill Use Repp+
 
Old 03-02-2008, 11:40 AM   #4 (permalink)
Registered Member
 
druidje's Avatar
 
Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57
druidje is a jewel in the rough
druidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the rough
try to add it directly under
Code:
public void moveItems(int from, int to, int moveWindow) {
__________________

Quote:
Originally Posted by zee_best View Post
Get sarah101 to sleep with kevin?
Quote:
Originally Posted by ject View Post
but try ::noclit or whatever
Developing 508!
druidje is offline  
Old 03-02-2008, 11:49 AM   #5 (permalink)
Гимн Советского Союза

 
soviet_'s Avatar
 
Join Date: Jul 2006
Posts: 4,417
Thanks: 3
Thanked 8 Times in 8 Posts
Rep Power: 1194
soviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificent
soviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificentsoviet_ is truly magnificent
This is perfect!

I congratulate you!
soviet_ is offline  
Old 03-02-2008, 11:52 AM   #6 (permalink)
Registered Member
 
druidje's Avatar
 
Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57
druidje is a jewel in the rough
druidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the rough
@ Sin
Thanks

@ Blacksmith
For me it works (doh :P)..
Instead of inserting, does it swaps? or doesn't it do anything?
__________________

Quote:
Originally Posted by zee_best View Post
Get sarah101 to sleep with kevin?
Quote:
Originally Posted by ject View Post
but try ::noclit or whatever
Developing 508!
druidje is offline  
Old 03-02-2008, 11:58 AM   #7 (permalink)
Registered Member
 
druidje's Avatar
 
Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57
druidje is a jewel in the rough
druidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the rough
Maybe you forgot to push the 'insert' button? :P
And don't miss the packet 185 actionbuttons..
__________________

Quote:
Originally Posted by zee_best View Post
Get sarah101 to sleep with kevin?
Quote:
Originally Posted by ject View Post
but try ::noclit or whatever
Developing 508!
druidje is offline  
Old 03-02-2008, 12:10 PM   #8 (permalink)
Registered Member
 
druidje's Avatar
 
Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57
druidje is a jewel in the rough
druidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the rough
You missed a } or you added a } to much :P
__________________

Quote:
Originally Posted by zee_best View Post
Get sarah101 to sleep with kevin?
Quote:
Originally Posted by ject View Post
but try ::noclit or whatever
Developing 508!
druidje is offline  
Old 03-02-2008, 12:36 PM   #9 (permalink)
Registered Member
 
druidje's Avatar
 
Join Date: Jan 2007
Posts: 382
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 57
druidje is a jewel in the rough
druidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the roughdruidje is a jewel in the rough
I'm glad it works... But I didn't add that line without a reason lol :P
That line is meant for the safety of anti-duping. I have been testing this for like umm.. 10 mins for a dupe glitch, but found nothing. On your server however there is a dupe glitch, thats why it disconnects :P
__________________

Quote:
Originally Posted by zee_best View Post
Get sarah101 to sleep with kevin?
Quote:
Originally Posted by ject View Post
but try ::noclit or whatever
Developing 508!
druidje is offline  
Old 03-02-2008, 01:21 PM   #10 (permalink)
Rune-Age

 
Join Date: Jan 2008
Posts: 1,804
Thanks: 0
Thanked 6 Times in 6 Posts
Rep Power: 255
Called Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond repute
Called Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond reputeCalled Enzo has a reputation beyond repute
Send a message via MSN to Called Enzo
Thnx again..

I did got that error also.. i removed it..

But does that line make it so u can't dupe?
Called Enzo is offline  
Closed Thread


Tags
bank, banking, insert, option, swap


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
vBulletin Style by: kreativfantasy.com