100% Perfect picking up ground items! + Video
Ok, i finally decided to release this!
This basically makes picking items from the floor the same as Runescapes (Private servers usually don't let you pick up the item unless you click on while standing on it)
Purpose: To add 100% real ground pickups!
Difficulty: 2
Assumed Knowledge: Basic java and how to declare
Server Base: I made this on my project SkattyScape, but it should work on p16 or Pimpscape.
Classes Modified: client.java
Procedure:
Step 1:
In process() (your 500ms boolean) add
Step 2:
Find your pickup item packet
and replace the contents of it with
Code:
int itemY = inStream.readSignedWordBigEndian();
int itemID = inStream.readUnsignedWord();
int itemX = inStream.readSignedWordBigEndian();
apickupid = itemID;
apickupx = itemX;
apickupy = itemY;
It should look something like this:
Code:
case 236: //pickup item
int itemY = inStream.readSignedWordBigEndian();
int itemID = inStream.readUnsignedWord();
int itemX = inStream.readSignedWordBigEndian();
apickupid = itemID;
apickupx = itemX;
apickupy = itemY;
break;
Now declare all this.
Code:
public int apickupid = -1;
public int apickupx = -1;
public int apickupy = -1;
public void scanPickup()
{
if (absX == apickupx && absY == apickupy)
{
if (ItemHandler.itemExists(apickupid, absX, absY))
{
int itemAmount = ItemHandler.itemAmount(apickupid, apickupx, apickupy);
if (addItem(apickupid, itemAmount))
{//only removes the item when has enough space!
ItemHandler.removeItem(apickupid, apickupx, apickupy, itemAmount);
removeGroundItem(apickupx, apickupy, apickupid);
apickupid = -1;
apickupx = -1;
apickupy = -1;
}
}
else if (hasntLoggedin){
sendMessage("Too late, its gone!");
apickupid = -1;
apickupx = -1;
apickupy = -1;
}
}
}
public boolean hasntLoggedin = false;
Now in your loading packet add
Code:
hasntLoggedin = true;
And your done!
This includes the, "Too late, its gone!" message, and it only removes the item from the ground when you have free inventory space.
Please post your errors since i copied this straight from my server and i may have missed something.
and now for the video!
http://youtube.com/watch?v=ca-f2lMtxCM
Video and tutorial 100% credits to me!
Now you can install my bug fix tut at http://rune-server.org/showthread.php?p=358715
I DO NOT HAVE A MOPAR ACCOUNT, IF YOU SEE THIS ANYWHERE ELSE IT HAS BEEN LEECHED