Author Topic: [Hyperion] ShooAway [Hyperion]  (Read 218 times)

Offline Scar

  • Steel Member
  • *
  • Posts: 34
  • Rep 1
    • View Profile
[Hyperion] ShooAway [Hyperion]
« on: March 11, 2011, 10:56:28 am »
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.
Code: [Select]
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. :hurr:

Share on Bluesky Share on Facebook


Offline AdotSells

  • Firecape Member
  • *
  • Posts: 300
  • Rep 4
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #1 on: March 11, 2011, 05:50:49 pm »
I dont know weather its me being stupid But could you explain what the Shooaway is :/ :-\

Offline Chandlermaki

  • Rune Member
  • *
  • Posts: 129
  • Rep 6
  • You's trollin'.
  • Location: USA
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #2 on: March 12, 2011, 01:16:16 am »
I dont know weather its me being stupid But could you explain what the Shooaway is :/ :-\
Looking at the code, it's shooing away a pet, or practically any other NPC you want to use.
Insert clever signature here.

Offline Scar

  • Steel Member
  • *
  • Posts: 34
  • Rep 1
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #3 on: March 12, 2011, 03:39:08 am »

 :uj:

Offline robgob

  • Adamant Member
  • *
  • Posts: 120
  • Rep 5
  • I swarm like locust
  • Location: Michigan
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #4 on: March 14, 2011, 03:59:53 pm »
Looks pretty good.

Offline Alex_Kilroy

  • Adamant Member
  • *
  • Posts: 91
  • Rep 2
  • Java programmer
  • Location: United Kingdom, England.
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #5 on: March 15, 2011, 07:51:12 am »
I've seen the original. I don't see much difference but they're probably will be. Good job other than that, just work on your conventions.
I'm a MEXICAN
#facepalm
My various other names are, Byte3, Kaex and Limbo.
I am now known as Alex_Kilroy.

Offline Scar

  • Steel Member
  • *
  • Posts: 34
  • Rep 1
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #6 on: March 15, 2011, 12:22:49 pm »
Theres nothing wrong with the conventions?

Offline Alex_Kilroy

  • Adamant Member
  • *
  • Posts: 91
  • Rep 2
  • Java programmer
  • Location: United Kingdom, England.
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #7 on: March 16, 2011, 12:10:46 am »
Theres nothing wrong with the conventions?

Quote
   @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;
      }

should be:

Quote
   @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;
      }

Cba doing all but you get my drift.
Also you don't need to print the output on everything, thats why I commented it out.
I'm a MEXICAN
#facepalm
My various other names are, Byte3, Kaex and Limbo.
I am now known as Alex_Kilroy.

Offline Moe505

  • Veteran
  • Firecape Member
  • *
  • Posts: 293
  • Rep 187
  • Location: Australia
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #8 on: March 16, 2011, 09:43:30 am »
Looks good.
It's buggy though.
@ Alex
You commented out the System.out thingy, is that a convention..?

Offline Alex_Kilroy

  • Adamant Member
  • *
  • Posts: 91
  • Rep 2
  • Java programmer
  • Location: United Kingdom, England.
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #9 on: March 16, 2011, 03:41:14 pm »
Looks good.
It's buggy though.
@ Alex
You commented out the System.out thingy, is that a convention..?

No its an output delivering text. And if your trying to be sarcastic, grow up.
I'm a MEXICAN
#facepalm
My various other names are, Byte3, Kaex and Limbo.
I am now known as Alex_Kilroy.

Offline AdotSells

  • Firecape Member
  • *
  • Posts: 300
  • Rep 4
    • View Profile
Re: [Hyperion] ShooAway [Hyperion]
« Reply #10 on: March 17, 2011, 05:42:37 am »
Looks good.
It's buggy though.
@ Alex
You commented out the System.out thingy, is that a convention..?

No its an output delivering text. And if your trying to be sarcastic, grow up.

To be fair alex  "People should get left to code how they want to " Weather its messy, Long ass code or what  its there way of doing it as long as it works it dont matter