Thread: NPCoption3

Results 1 to 9 of 9
  1. #1 NPCoption3 
    Registered Member
    ƅʅ1ƭȥȥ ツ's Avatar
    Join Date
    May 2008
    Age
    19
    Posts
    1,132
    Thanks
    10
    Thanked 8 Times in 5 Posts
    Rep Power
    330
    hey I try'd To add the NpcOption3 from: Pie

    But I have this error:

    Code:
    Compiling palidino76.rs2
    .\palidino76\rs2\io\packets\NPCOption3.java:37: orphaned case
    case 4250: // Npc id
    ^
    1 error
    Druk op een toets om door te gaan. . .
    and this is the File

    Code:
    /*
     * Class NPCOption3
     *
     * Created by Pie
     */
    
    package palidino76.rs2.io.packets;
    
    import palidino76.rs2.Engine;
    import palidino76.rs2.npcs.*;
    import palidino76.rs2.player.skills.*;
    import palidino76.rs2.player.Player;
    import palidino76.rs2.util.Misc;
    
    public class NPCOption3 implements Packet {
        /**
         * Handles the Third NPC option.
         * @param p The Player which the frame should be handled for.
         * @param packetId The packet id this belongs to.
         * @param packetSize The amount of bytes being recieved for this packet.
         */
        public void handlePacket(Player p, int packetId, int packetSize) {
            if (p == null || p.stream == null) {
                return;
            }
            p.npcClick2 = p.stream.readUnsignedWordBigEndian();
    	p.requestFaceTo(p.clickId);
    	PlayerThieving playerThieving = new PlayerThieving(p);
    	int k = p.skillLvl[10];
    	NPC n = Engine.npcs[p.npcClick2];
    	if (n == null) {
    		return;
    	}
    	if (Misc.getDistance(p.absX, p.absY, n.absX, n.absY) > 2) {
    		return;
    
    case 4250: // Npc id
    		Engine.shopHandler.openshop(p, 17);
    break;
    
            default:
                System.out.println("[" + p.username + "] Unhandled npc option 3: " + p.npcClick2);
                break;
            
        }
      }
    }
    thanks Bl1tzz,
    Reply With Quote  
     

  2. #2  
    This.
    Shocker's Avatar
    Join Date
    Dec 2006
    Age
    17
    Posts
    2,218
    Thanks
    5
    Thanked 21 Times in 17 Posts
    Rep Power
    1000
    if (Misc.getDistance(p.absX, p.absY, n.absX, n.absY) > 2)
    return;

    that line shouldn't have a curly bracket at the end
    ~Shocker
    Reply With Quote  
     

  3. #3  
    Registered Member
    ƅʅ1ƭȥȥ ツ's Avatar
    Join Date
    May 2008
    Age
    19
    Posts
    1,132
    Thanks
    10
    Thanked 8 Times in 5 Posts
    Rep Power
    330
    Quote Originally Posted by Shocker View Post
    if (Misc.getDistance(p.absX, p.absY, n.absX, n.absY) > 2)
    return;

    that line shouldn't have a curly bracket at the end
    I removed thad bracket Still Same errors as above
    Reply With Quote  
     

  4. #4  
    Doctor p - Sweet Shop


    Join Date
    Apr 2007
    Age
    20
    Posts
    6,841
    Thanks
    142
    Thanked 590 Times in 340 Posts
    Rep Power
    2361
    Code:
    public class NPCOption3 implements Packet {
    /**
    * Handles the Third NPC option.
    * @param p The Player which the frame should be handled for.
    * @param packetId The packet id this belongs to.
    * @param packetSize The amount of bytes being recieved for this packet.
    */
        public void handlePacket(Player p, int packetId, int packetSize) {
            if (p == null || p.stream == null) {
                return;
            }
            p.npcClick2 = p.stream.readUnsignedWordBigEndian();
            p.requestFaceTo(p.clickId);
            PlayerThieving playerThieving = new PlayerThieving(p);
            int k = p.skillLvl[10];
            NPC n = Engine.npcs[p.npcClick2];
            if (n == null) {
                return;
            }
            if (Misc.getDistance(p.absX, p.absY, n.absX, n.absY) > 2) {
                return;
            }
            switch(n.npcType) {
                case 4250: // Npc id
                    Engine.shopHandler.openshop(p, 17);
                break;
                default:
                    System.out.println("[" + p.username + "] Unhandled npc option 3: " + p.npcClick2);
                break;
            }
        }
    }
    Reply With Quote  
     

  5. #5  
    Registered Member
    ƅʅ1ƭȥȥ ツ's Avatar
    Join Date
    May 2008
    Age
    19
    Posts
    1,132
    Thanks
    10
    Thanked 8 Times in 5 Posts
    Rep Power
    330
    Quote Originally Posted by Nathan View Post
    Code:
    public class NPCOption3 implements Packet {
    /**
    * Handles the Third NPC option.
    * @param p The Player which the frame should be handled for.
    * @param packetId The packet id this belongs to.
    * @param packetSize The amount of bytes being recieved for this packet.
    */
        public void handlePacket(Player p, int packetId, int packetSize) {
            if (p == null || p.stream == null) {
                return;
            }
            p.npcClick2 = p.stream.readUnsignedWordBigEndian();
            p.requestFaceTo(p.clickId);
            PlayerThieving playerThieving = new PlayerThieving(p);
            int k = p.skillLvl[10];
            NPC n = Engine.npcs[p.npcClick2];
            if (n == null) {
                return;
            }
            if (Misc.getDistance(p.absX, p.absY, n.absX, n.absY) > 2) {
                return;
            }
            switch(n.npcType) {
                case 4250: // Npc id
                    Engine.shopHandler.openshop(p, 17);
                break;
                default:
                    System.out.println("[" + p.username + "] Unhandled npc option 3: " + p.npcClick2);
                break;
            }
        }
    }
    Nathan I try'd TO add yours But I get this Error

    Code:
    Compiling palidino76.rs2
    .\palidino76\rs2\io\PacketManager.java:375: non-static method handlePacket(palid
    ino76.rs2.player.Player,int,int) cannot be referenced from a static context
                NPCOption3.handlePacket(p, packetId, packetSize);
                          ^
    1 error
    Druk op een toets om door te gaan. . .
    I am not So Good in English to Understand it
    Reply With Quote  
     

  6. #6  
    Doctor p - Sweet Shop


    Join Date
    Apr 2007
    Age
    20
    Posts
    6,841
    Thanks
    142
    Thanked 590 Times in 340 Posts
    Rep Power
    2361
    Quote Originally Posted by Bl1tzz View Post
    Nathan I try'd TO add yours But I get this Error

    Code:
    Compiling palidino76.rs2
    .\palidino76\rs2\io\PacketManager.java:375: non-static method handlePacket(palid
    ino76.rs2.player.Player,int,int) cannot be referenced from a static context
                NPCOption3.handlePacket(p, packetId, packetSize);
                          ^
    1 error
    Druk op een toets om door te gaan. . .
    I am not So Good in English to Understand it
    post packetmanager.java
    Reply With Quote  
     

  7. #7  
    Registered Member
    ƅʅ1ƭȥȥ ツ's Avatar
    Join Date
    May 2008
    Age
    19
    Posts
    1,132
    Thanks
    10
    Thanked 8 Times in 5 Posts
    Rep Power
    330
    There

    /*
    * Class PacketManager
    *
    * Version 1.0
    *
    * Sunday, August 17, 2008
    *
    * Created by Palidino76
    */

    package palidino76.rs2.io;

    import palidino76.rs2.Server;
    import palidino76.rs2.Engine;
    import palidino76.rs2.player.Magic;
    import palidino76.rs2.player.Player;
    import palidino76.rs2.util.Misc;
    //import palidino76.rs2.net.packethandler.*;
    import palidino76.rs2.io.packets.*;

    public class PacketManager {
    /*
    * Create all the packets for use.
    */
    public Walking walk = new Walking();
    public PublicChat publicChat = new PublicChat();
    public Commands command = new Commands();
    public SwitchItems switchItems = new SwitchItems();
    public ActionButtons actionButtons = new ActionButtons();
    public Equipment equipment = new Equipment();
    public ItemOption1 itemOption1 = new ItemOption1();
    public ItemOperate itemOperate = new ItemOperate();
    public ItemOnItem itemOnItem = new ItemOnItem();
    public DropItem dropItem = new DropItem();
    public PickupItem pickupItem = new PickupItem();
    public PlayerOption1 playerOption1 = new PlayerOption1();
    public PlayerOption2 playerOption2 = new PlayerOption2();
    public PlayerOption3 playerOption3 = new PlayerOption3();
    public NPCAttack npcAttack = new NPCAttack();
    public NPCOption1 npcOption1 = new NPCOption1();
    public NPCOption2 npcOption2 = new NPCOption2();
    public NPCOption3 npcOption3 = new NPCOption3();
    public ItemSelect itemSelect = new ItemSelect();
    public ObjectOption1 objectOption1 = new ObjectOption1();
    public ObjectOption2 objectOption2 = new ObjectOption2();
    public SwitchItems2 switchItems2 = new SwitchItems2();
    public ItemOnNPC itemOnNPC = new ItemOnNPC();
    public ItemOnObject itemOnObject = new ItemOnObject();
    public MagicOnNPC magicOnNPC = new MagicOnNPC();

    public PacketManager() {
    }

    /**
    * Handle any packets.
    * <p>Handles all packets within the range of 0 - 255. Not every
    * packet has been setup, you'll have to do some yourself.
    * @param p The Player which the frame should be created for.
    * @param packetId The packet id to handle.
    * @param packetSize The number of bytes the packet contains.
    */
    public void parsePacket(Player p, int packetId, int packetSize) {
    Player en = Engine.players[p.enemyIndex];
    if (p == null) {
    return;
    }
    if (p.clickDelay > 0 && packetId != 222) {
    /*
    * When delayed only allow chatting.
    */
    return;
    }
    if (p.magicOnPlayer) {
    if (p.combatDelay <= 0) {
    Magic.magicAop(p, packetId, packetSize);
    }
    }
    switch (packetId) {

    case 30:
    long name = p.stream.readQWord();
    if(p.friends.size() >= 200) {
    p.frames.sendMessage(p, "Your friends list is full.");
    break;
    }
    if(p.friends.contains((Long) name)) {
    p.frames.sendMessage(p, "That player is already on your friends list.");
    break;
    }
    p.friends.add((Long) name);
    p.frames.sendFriend(p, name, p.getWorld(name));
    break;

    case 24://magic on npc by I loot I aka Lootface
    MagicOnNPC.magicAop(p, packetId, packetSize);
    //Misc.println("["+p.username+"]: packet: "+packetId);
    break;

    case 61:
    name = p.stream.readQWord();
    if(p.ignores.size() >= 100) {
    p.frames.sendMessage(p, "Your ignore list is full.");
    break;
    }
    if(p.ignores.contains((Long) name)) {
    p.frames.sendMessage(p, "That player is already on your ignore list.");
    break;
    }
    p.ignores.add((Long) name);
    break;
    case 253:
    int playerId = p.stream.readUnsignedWord();
    playerId -= 33024;
    playerId = playerId / 256;
    playerId++;
    if (playerId < 0 || playerId >= Engine.players.length ||

    Engine.players[playerId] == null) {
    return;
    }
    if (Engine.players[playerId].pTrade.getPartner() == p) {
    p.pTrade.tradePlayer(Engine.players[playerId]);
    }

    break;
    case 46:
    p.frames.showInterface(p, 109);
    break;
    case 132:
    name = p.stream.readQWord();
    p.friends.remove((Long) name);
    break;

    case 2:
    name = p.stream.readQWord();
    p.ignores.remove((Long) name);
    break;

    case 178:
    name = p.stream.readQWord();
    int numChars = p.stream.readUnsignedByte();
    String text = Misc.decryptPlayerChat(p.stream, numChars);
    for(Player p2 : Engine.players) {
    if(p2 != null && p2.online) {
    if(Misc.stringToLong(p2.username) == name) {
    p2.frames.sendReceivedPrivateMessage(p2,

    Misc.stringToLong(p.username), p.rights, text);
    p.frames.sendSentPrivateMessage(p, name, text);
    return;
    }
    }
    }
    p.frames.sendMessage(p, "That player is unavailable.");
    break;

    case 154:
    Magic.MagicOnItemHandle(p, packetId, packetSize);
    break;
    case 70:
    p.requestFaceTo(p.enemyIndex + 32768);
    p.attackPlayer = p.stream.readSignedWordA();
    p.pID = p.stream.readSignedWordBigEndian();
    p.interfaceID = p.stream.readUnsignedWord();
    p.clickId = p.stream.readUnsignedWord();
    Magic.magicAop(p, packetId, packetSize);
    break;

    case 224:
    /**
    * Item on Object
    */
    itemOnObject.createPacket(p);
    break;
    case 115:
    /*
    * This packet is constantly sent almost like a ping to verify the still

    exists.
    */
    break;
    case 22:
    /*
    * Recieved every time updateReq is set to true.
    */
    p.stream.readDWord(); // Junk? Same value every time.
    break;
    case 12:
    /**
    * Item on NPC
    */
    itemOnNPC.addItemOnNPCEvent(p);
    break;
    case 60:
    p.objects();
    break;
    case 62:
    p.objects();
    break;
    case 99:
    /*
    * Unknown.
    */
    p.stream.readUnsignedWordBigEndianA();
    p.stream.readUnsignedWordA();
    break;
    case 117:
    case 248:
    case 247: // Possibly a packet sent if the login is successful.
    /*
    * Unknown.
    */
    break;
    case 59:
    /*
    * Send every time you click your mouse.
    */
    p.stream.readUnsignedWord();
    p.stream.readDWord_v1();
    break;
    case 49:
    /*
    * Main map walking.
    */
    case 119:
    /*
    * Minimap walking.
    */
    if(
    p.interfaceId==762 ||
    p.interfaceId==335 ||
    p.interfaceId==334 ||
    p.interfaceId==620) {
    return;
    }
    case 138:
    /*
    * Other walking.
    */
    walk.handlePacket(p, packetId, packetSize);
    p.objects();

    break;
    case 222:
    /*
    * Public chatting.
    */
    publicChat.handlePacket(p, packetId, packetSize);
    break;
    case 107:
    /*
    * When you type text starting with ::, its sent with this packet Id rather

    than as
    * Normal chat.
    */
    command.handlePacket(p, packetId, packetSize);
    break;
    case 167:
    /*
    * Switching items on interfaces.
    */
    switchItems.handlePacket(p, packetId, packetSize);
    break;
    case 233:
    case 113:
    case 21:
    case 169:
    case 232:
    case 250:
    case 214:
    case 90:
    case 199:

    /*
    * When you click an interface button this packet is sent.
    */
    actionButtons.handlePacket(p, packetId, packetSize);
    break;
    case 3:
    /*
    * Equipping an item.
    */
    equipment.handlePacket(p, packetId, packetSize);
    break;
    case 203:
    /*
    * Item options 1.
    */
    itemOption1.handlePacket(p, packetId, packetSize);
    break;
    case 186:
    /*
    * Item operating.
    */

    if (p.viewings == 0) {
    itemOperate.handlePacket(p, packetId, packetSize);
    }
    break;
    case 211:
    /*
    * Dropping an item.
    */
    dropItem.handlePacket(p, packetId, packetSize);
    break;
    case 201:
    /*
    * Picking an item up.
    */
    pickupItem.handlePacket(p, packetId, packetSize);
    break;
    case 160:
    /*
    * First option on a player.
    */
    playerOption1.handlePacket(p, packetId, packetSize);
    break;
    case 37:
    /*
    * Second option on a player.
    */
    playerOption2.handlePacket(p, packetId, packetSize);
    break;
    case 227:
    /*
    * Third option on a player.
    */
    playerOption3.handlePacket(p, packetId, packetSize);
    break;
    case 123:
    /*
    * NPC attack option.
    */
    npcAttack.handlePacket(p, packetId, packetSize);
    break;
    case 7:
    /*
    * NPC first option.
    */
    npcOption1.handlePacket(p, packetId, packetSize);
    break;
    case 220:
    /*
    * Item eating, drinking, etc.
    */
    itemSelect.handlePacket(p, packetId, packetSize);
    break;
    case 158:
    /*
    * Object first option.
    */
    objectOption1.handlePacket(p, packetId, packetSize);
    break;
    case 165:
    /*
    * Settings buttons, such as music volume.
    */
    p.stream.readDWord_v2();
    break;
    case 108:
    /*
    * Remove open interfaces.
    */
    p.viewings = 0;
    p.frames.removeShownInterface(p);
    break;
    case 228:
    /*
    * Second object option.
    */
    objectOption2.handlePacket(p, packetId, packetSize);
    break;
    case 52:
    /*
    * Second NPC option.
    */
    npcOption2.handlePacket(p, packetId, packetSize);
    break;
    /*
    * third NPC option.
    */
    NPCOption3.handlePacket(p, packetId, packetSize);
    break;
    case 38:
    /*
    * Item examining.
    */
    p.frames.sendMessage(p,

    Engine.items.getItemDescription(p.stream.readUnsig nedWordBigEndianA()));
    break;
    case 88:
    /*
    * NPC examining.
    */
    p.frames.sendMessage(p,

    Server.engine.getNPCDescription(p.stream.readUnsig nedWord()));
    break;
    case 84:
    /*
    * Object examining.
    */
    int objectId = p.stream.readUnsignedWordA();
    p.frames.sendMessage(p, "An object.");
    break;
    case 47:
    /*
    * Idle packet.
    */
    break;

    /*case 70:
    // Magic on Player Packet.

    new MagicOnPlayer(p);
    break;*/

    case 40:
    /**
    * Item on item packet
    */
    itemOnItem.handlePacket(p, packetId, packetSize);
    break;
    case 179:
    /*
    * Switching items on interfaces.
    */
    switchItems2.handlePacket(p, packetId, packetSize);
    break;

    case 221:
    p.updateHP(10, true);
    break;

    case 63:
    /**
    * First option on options.
    */
    new OptionClicking(p);
    break;
    case 94:
    /*
    * The Button to open your History
    */
    p.openHis();
    break;
    case 190:
    /*
    * The Button to open up the set's.
    */
    p.openSets();
    break;

    default:
    Misc.println("[" + p.username + "] Unhandled packet: " + packetId);
    break;
    }
    }
    }
    Reply With Quote  
     

  8. #8  
    Doctor p - Sweet Shop


    Join Date
    Apr 2007
    Age
    20
    Posts
    6,841
    Thanks
    142
    Thanked 590 Times in 340 Posts
    Rep Power
    2361
    replace

    Code:
    NPCOption3.handlePacket(p, packetId, packetSize);
    with

    Code:
    npcOption3.handlePacket(p, packetId, packetSize);
    Reply With Quote  
     

  9. #9  
    Registered Member
    ƅʅ1ƭȥȥ ツ's Avatar
    Join Date
    May 2008
    Age
    19
    Posts
    1,132
    Thanks
    10
    Thanked 8 Times in 5 Posts
    Rep Power
    330
    Wewt I had To add A Case to it :P and yours worked thanks

    bl1tzz, GOing to finish Sawmill
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

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