Thread: Hyperion PackeT error

Results 1 to 3 of 3
  1. #1 Hyperion PackeT error 
    Banned
    Join Date
    Jan 2013
    Posts
    132
    Thanks given
    23
    Thanks received
    36
    Rep Power
    0
    Code:
    Jan 15, 2013 3:43:41 AM org.hyperion.rs2.net.PacketManager handle
    SEVERE: Exception handling packet.
    java.lang.NullPointerException
    	at org.hyperion.rs2.packet.NPCOptionPacketHandler.handleOption(NPCOptionPacketHandler.java:54)
    	at org.hyperion.rs2.packet.NPCOptionPacketHandler.handle(NPCOptionPacketHandler.java:29)
    	at org.hyperion.rs2.net.PacketManager.handle(PacketManager.java:79)
    	at org.hyperion.rs2.task.impl.SessionMessageTask.execute(SessionMessageTask.java:42)
    	at org.hyperion.rs2.GameEngine$1.run(GameEngine.java:108)
    	at org.hyperion.rs2.GameEngine$5.run(GameEngine.java:191)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    	at java.util.concurrent.FutureTask.run(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Code:
    package org.hyperion.rs2.packet;
    
    import org.hyperion.rs2.action.impl.AttackAction;
    import org.hyperion.rs2.content.skills.Fishing;
    import org.hyperion.rs2.content.skills.Fishing.Fish;
    import org.hyperion.rs2.model.Item;
    import org.hyperion.rs2.model.NPC;
    import org.hyperion.rs2.model.Player;
    import org.hyperion.rs2.model.World;
    import org.hyperion.rs2.model.container.Equipment;
    import org.hyperion.rs2.net.Packet;
    
    /**
     * @author James
     * @description NPCOption
     * @date 15-Jan-2013
     */
    public class NPCOptionPacketHandler implements PacketHandler {
    	
    	private static final int ATTACK = 72, OPTION_1 = 155, OPTION_2 = 17;
    
        @Override
        public void handle(Player player, Packet packet) {
            switch (packet.getOpcode()) {
                case ATTACK:
                    handleAttack(player, packet);
                    break;
                case OPTION_1:
                    handleOption(player, packet);
                    break;
            }
        }
    
        private void handleAttack(Player player, Packet packet) {
            final int npcSlot = packet.getShortA() & 0xFFFF;
            NPC npc = (NPC) World.getWorld().getNPCs().get(npcSlot);
            int npcId = npc.getDefinition().getId();
            int npcX = npc.getLocation().getX();
            int npcY = npc.getLocation().getY();
            Item weapon = player.getEquipment().get(Equipment.SLOT_WEAPON);
            NPC victim = (NPC) World.getWorld().getNPCs().get(npcId);
            /**
             * Attacking NPC
             */
            if (npc != null && player.getLocation().isWithinInteractionDistance(npc.getLocation())) {
                player.getActionQueue().addAction(new AttackAction(player, npc));
            }
            System.out.println("NPC: " + npcId);
        }
        
        private void handleOption(Player player, Packet packet) {
            final int npcSlot = packet.getShortA() & 0xFFFF;
            NPC npc = (NPC) World.getWorld().getNPCs().get(npcSlot);
            int npcId = npc.getDefinition().getId();
            int npcX = npc.getLocation().getX();
            int npcY = npc.getLocation().getY();
            Item weapon = player.getEquipment().get(Equipment.SLOT_WEAPON);
            NPC victim = (NPC) World.getWorld().getNPCs().get(npcId);
    
            
            /**
             * Fishing by James
             */
            Fish fish = Fish.forId(npcId);
            if (fish != null && player.getLocation().isWithinInteractionDistance(npc.getLocation())) {
                Fishing.Fish.fish(new Item(weapon.getId()), player);
            }
            System.out.println("NPC: " + npcId);
        }
    }
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Oct 2012
    Posts
    33
    Thanks given
    4
    Thanks received
    19
    Rep Power
    47
    Code:
    private void handleOption(Player player, Packet packet) {
            final int npcSlot = packet.getShortA() & 0xFFFF;
            NPC npc = (NPC) World.getWorld().getNPCs().get(npcSlot);
            if (npc == null) { return; }
            int npcId = npc.getDefinition().getId();
            int npcX = npc.getLocation().getX();
            int npcY = npc.getLocation().getY();
            Item weapon = player.getEquipment().get(Equipment.SLOT_WEAPON);
            NPC victim = (NPC) World.getWorld().getNPCs().get(npcId);
            if (victim == null) { return; }
            
            /**
             * Fishing by James
             */
            Fish fish = Fish.forId(npcId);
            if (fish != null && player.getLocation().isWithinInteractionDistance(npc.getLocation())) {
                Fishing.Fish.fish(new Item(weapon.getId()), player);
            }
            System.out.println("NPC: " + npcId);
        }
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Jan 2013
    Posts
    132
    Thanks given
    23
    Thanks received
    36
    Rep Power
    0
    thanks, i dont think my fishing is correct
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Hyperion [Error] - $10-$15
    By D A N in forum Buying
    Replies: 5
    Last Post: 01-13-2013, 03:10 PM
  2. Hyperion [Error]
    By D A N in forum Help
    Replies: 3
    Last Post: 01-12-2013, 01:12 PM
  3. Replies: 2
    Last Post: 05-26-2011, 05:59 AM
  4. Error [HYPERION]
    By Rawr-Rawr in forum Help
    Replies: 4
    Last Post: 10-25-2010, 02:11 AM
  5. Hyperion T2 error.
    By craig903 in forum Help
    Replies: 2
    Last Post: 12-16-2009, 01:13 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •