Description: To add picking up to RS2E 503 including removing ground items.
Difficulty: 2/10
Assumed Knowledge: Copy and pasting, adding a class file.
Tested Server: RS2E V2.
Files/Classes Modified: HandlePacket.java
Files/Classes Created: PickupItem.java
Procedure
Step 1: Open HandlePacket.java and add:
Code:
case 106:
int x = p.inStream.readSignedWordBigEndianA();
int id = p.inStream.readUnsignedWord();
int y = p.inStream.readSignedWordA();
PickupItem pi = new PickupItem(p, x, y, id);
break;
Step 2: Close HandlePacket.java and save it. Now create a new class file named PickupItem.java and add this in there:
Code:
/*
* Class PickupItem
*
* Version 1.0
*
* Monday, August 11, 2008
*
* Created by Adam (Skiiii)
*/
package RS2E.Packets;
import RS2E.Players.Player;
import RS2E.Players.PlayerItems;
public class PickupItem {
public PickupItem(Player p, int x, int y, int id) {
if(p == null || p.inStream == null) {
return;
}
p.outStream.createFrame(218);
p.outStream.writeByteA((x - ((p.mapRegionX - 6) * 8)));
p.outStream.writeByte((y - ((p.mapRegionY - 6) * 8)));
p.outStream.createFrame(55);
p.outStream.writeWordBigEndian(id);
p.outStream.writeByte(0);
PlayerItems pi = new PlayerItems();
pi.addItem(p, id, 1);
}
}
Step 3: Save, Close and Compile, and you're done.
Credits: Credits to Laxika for the frame (55), Pali for RS2E and Me for the class file and usage.