Hello peoples!
I will be showing you how to add a ShooAway packet.
This is for Hyperion based servers ONLY!
It can be converted though...
Go to your source, add this to the packet folder;
Make a new folder called ShooAwayPacket in the Packet folder.
package org.hyperion.rs2.packet;
import org.hyperion.rs2.Constants;
import org.hyperion.rs2.event.Event;
import org.hyperion.rs2.model.Animation;
import org.hyperion.rs2.model.NPC;
import org.hyperion.rs2.model.Player;
import org.hyperion.rs2.model.World;
import org.hyperion.rs2.net.Packet;
import org.hyperion.rs2.util.LocationChecker;
public class ShooAwayPacket implements PacketHandler {
@Override
public void handle(final Player player, Packet packet) {//don't worry about it
int id = packet.getLEShort() & 0xFFFF;//don't worry about it
System.out.println(id);//don't worry about it
if(id < 0 || id >= Constants.MAX_NPCS) {//don't worry about it
return;
}
if(player.getCombatState().isDead()) {//don't worry about it
return;
}
player.getActionQueue().clearRemovableActions();
final NPC npc = (NPC) World.getWorld().getNPCs().get(id);
player.face(npc.getLocation());// makes you face the dog
if(npc != null) {
switch(npc.getDefinition().getId()) {
case 5917:// grey smelly dog NPC ID
case 5918:// brown smelly dog NPC ID
/** add more NPC IDS if you like, you can shoo away anything!**/
player.forceChat("Thbbbbt!");// force chats you to say 'Thbbbbt!'
player.playAnimation(Animation.RASPBERRY);// gets the raspberry animation
npc.playAnimation(Animation.create(4774));// play the animation 4774
World.getWorld().submit(new Event(1000) {
public void execute() {
LocationChecker.refreshDog(npc); // wait till the dogs sees you're scaring him
npc.getWalkingQueue().addStep(LocationChecker.npcLocation(npc, player, 2).getX(), // checks current location and moves away from it
LocationChecker.npcLocation(npc, player, 2).getY());// checks current location and moves away from it
stop();
}
});
break;
}
}
}
}
Credits:
45% do the person who released the shitty ShooAway packet
55% to me for fixing bugs, making it nearly perfect
Have a nice day.
