Thread: NPCOption3[Packet 199]

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 NPCOption3[Packet 199] 
    Registered Member

    Join Date
    May 2008
    Posts
    972
    Thanks given
    0
    Thanks received
    9
    Rep Power
    234
    Purpose: To support packet 199.

    Difficulty: 9/10

    Files Modified: Player.class, PacketManager.class

    Files Created: NPCOption3.class

    Credits: The Java Guru(Annexation), and Me.


    Step 1:
    Go into your Packet Handler Folder.
    Add this:*CHANGE THE IMPORTS TO YOURS*
    Name it: NPCOption3.java
    Code:
    /*
     * Class NPCOption3
     *
     * Version 1.0
     *
     * Sunday, September 13, 2009
     *
     * Created by a Person
     */
    
    package net.com.codeusa.net.packethandler;
    
    import net.com.codeusa.Server;
    import net.com.codeusa.Engine;
    import net.com.codeusa.npcs.*;
    import net.com.codeusa.model.skills.*;
    import net.com.codeusa.model.games.*;
    import net.com.codeusa.model.combat.*;
    import net.com.codeusa.model.Player;
    import net.com.codeusa.util.Misc;
    
    public class NPCOption3 implements Packet {
    
        public void handlePacket(Player p, int packetId, int packetSize) {
            if (p == null || p.stream == null) {
                return;
            }
            if (!p.npcOption3) {
                int npcId = p.stream.readUnsignedWordBigEndian();
                if (npcId <= 0 || npcId >= Engine.npcs.length || Engine.npcs[npcId] == null) {
                    return;
                }
                p.clickId = npcId;
                p.clickX = Engine.npcs[npcId].absX;
                p.clickY = Engine.npcs[npcId].absY;
                if (Misc.getDistance(p.absX, p.absY, p.clickX, p.clickY) > 30) {
                    return;
                }
                p.npcOption3 = true;
            }
            if (p.clickId <= 0 || p.clickId >= Engine.npcs.length || Engine.npcs[p.clickId] == null) {
                p.npcOption3 = false;
                return;
            }
            if (Misc.getDistance(p.absX, p.absY, p.clickX, p.clickY) > 1) {
                return;
            }
            p.npcOption3 = false;
            switch (p.clickId) {		
            default:
    			Misc.println("[" + p.username + "] Unhandled npc option 3: " + p.clickId);
                break;
            }
        }
    }
    Step 2:
    Open up PacketManager.java
    Search for:
    Code:
    public NPCOption2 npcOption2 = new NPCOption2();
    Under it, add:
    Code:
    public NPCOption3 npcOption3 = new NPCOption3();
    Step 3:
    Search for:
    Code:
    case 52:
    You should see:
    Code:
    case 52:
                /*
                 * Second NPC option.
                 */
                npcOption2.handlePacket(p, packetId, packetSize);
                break;
    Under it, add:
    Code:
    case 199:
                /*
                 * Third NPC option.
                 */
                npcOption3.handlePacket(p, packetId, packetSize);
                break;
    Step 4:
    Open up Player.java
    Search for:
    Code:
    public boolean npcOption2 = false;
    Under it, add:
    Code:
    /**
         * Clicked the third option on a NPC.
         */
        public boolean npcOption3 = false;
    Step 5:
    Search for:
    Code:
    if (npcOption2) {
    Under:
    Code:
    if (npcOption2) {
                Engine.packets.npcOption2.handlePacket(this, 0, 0);
            }
    Add:
    Code:
    if (npcOption3) {
                Engine.packets.npcOption3.handlePacket(this, 0, 0);
            }
    Step 6:
    Search for:
    Code:
    npcOption2 = false;
    Under it, add:
    Code:
    npcOption3 = false;
    There you go.

    Code:
    Support Rule-12:http://tinyurl.com/supportsig
    Reply With Quote  
     

  2. #2  
    ilikechoco
    Guest
    new NPCOption3().handlePacket(Usage);


    ^ Way better
    Reply With Quote  
     

  3. #3  
    Certified Stoner

    demon dylan001's Avatar
    Join Date
    Feb 2009
    Age
    25
    Posts
    1,127
    Thanks given
    77
    Thanks received
    94
    Discord
    View profile
    Rep Power
    509
    what base is this for i need one for espeon but it like logs me out when i use npc option 3.
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    May 2008
    Posts
    972
    Thanks given
    0
    Thanks received
    9
    Rep Power
    234
    This is for anything, tested on Espeon though.

    Code:
    Support Rule-12:http://tinyurl.com/supportsig
    Reply With Quote  
     

  5. #5  
    Certified Stoner

    demon dylan001's Avatar
    Join Date
    Feb 2009
    Age
    25
    Posts
    1,127
    Thanks given
    77
    Thanks received
    94
    Discord
    View profile
    Rep Power
    509
    o ok il try it =)


    missing a import do you know which one?


    nevermind my fault i forgot to change the location


    Goodwork Rep =)
    Reply With Quote  
     

  6. #6  
    Registered Member
    shassan's Avatar
    Join Date
    Oct 2008
    Age
    28
    Posts
    1,218
    Thanks given
    8
    Thanks received
    42
    Rep Power
    201
    does this contain the correct stream?
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Mar 2009
    Age
    28
    Posts
    1,008
    Thanks given
    32
    Thanks received
    7
    Rep Power
    111
    This is used for "collect" on bankers, pickpocketing i think
    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Mar 2009
    Age
    28
    Posts
    1,008
    Thanks given
    32
    Thanks received
    7
    Rep Power
    111
    Lol, my Npc Option2/3 Dc u
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Aug 2009
    Posts
    1,712
    Thanks given
    96
    Thanks received
    198
    Rep Power
    78
    You edit .class files? lol...
    Reply With Quote  
     

  10. #10  
    :doge:

    Join Date
    Jan 2009
    Posts
    3,759
    Thanks given
    221
    Thanks received
    816
    Rep Power
    2113
    Quote Originally Posted by 03data View Post
    You edit .class files? lol...
    You are an idiot l0l0l0l. a class file is a .class file, but the real name for a .java file is a Class..
    OT: good job for people that didn't have, more of a snippet though.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •