h productions



Join the forum, it's quick and easy

h productions

h productions

Would you like to react to this message? Create an account in a few clicks or log in to continue.
h productions

h productions evrything about setting up a game or server eg.runescape private server and runing it

Log in

I forgot my password

mp3player


Get a playlist! Standalone player Get Ringtones

Who is online?

In total there are 2 users online :: 0 Registered, 0 Hidden and 2 Guests

None


[ View the whole list ]


Most users ever online was 101 on Wed Jul 03, 2019 3:46 am

online chat

Chat login:
Nickname
Password (optional)

powered by h-prodz.co.cc

Latest topics

» New things for you
how to add shops[tut] EmptySun Nov 29, 2009 6:56 pm by marden

» DUN DUN DUN!
how to add shops[tut] EmptySun Nov 22, 2009 10:33 am by awesome pker

» tradescape stay online? or go away
how to add shops[tut] EmptyTue Aug 25, 2009 1:50 pm by FiZiX the second

» fix read!!!
how to add shops[tut] EmptyMon Aug 10, 2009 7:25 am by FiZiX the second

» LIGHT FALCONS SERVER HERE
how to add shops[tut] EmptyFri Jul 10, 2009 7:05 am by light falcon

» New CO Owner
how to add shops[tut] EmptyFri Jun 26, 2009 9:11 am by awesome pker

» I'm getting bored...
how to add shops[tut] EmptyFri Jun 26, 2009 7:26 am by Fizix

» what to post here
how to add shops[tut] EmptyMon Jun 22, 2009 12:26 pm by Fizix

» 2 servers 1 port LOOK!!!
how to add shops[tut] EmptyMon Jun 22, 2009 12:13 pm by Fizix

Navigation

Affiliates


    how to add shops[tut]

    Admin
    Admin
    Admin
    Admin


    Posts : 88
    Reputation : 5
    Join date : 2009-04-14

    how to add shops[tut] Empty how to add shops[tut]

    Post  Admin Sat Apr 18, 2009 10:59 am

    Difficulty: 2/10
    Base: Palidinos Normal 508 base...
    This is to add shops with the correct interface to your server


    Step 1.

    Ok first we are going to need to find "PacketManager.java".
    This can be found at "palidino76\rs2\io"...
    Once you have opened the file, search for:


    Code:
        case 232:
            case 90:

    And add these other cases if you dont have them..


    Code:
     case 233:
            case 113:
            case 21:
            case 214:
            case 169:
            case 232:
            case 90:
                /*
                * When you click an interface button this packet is sent.
                */
                actionButtons.handlePacket(p, packetId, packetSize);

    Remember if you do NOT have any of this then add it, because this basically makes all packets be sent to the server knowing you are clicking the correct buttons on each interface..

    Save and close "PacketManager.java"

    Step 2.

    Now we are going to need to find "ActionButtons.java"
    This is located at "palidino76\rs2\io\packets"...

    Ok open that file and search for:


    Code:
    public void handlePacket

    Replace it with this:

    Code:
    public void handlePacket(Player p, int packetId, int packetSize) {
            if (p == null || p.stream == null) {
                return;
            }
            int interfaceId = p.stream.readUnsignedWord();
            int buttonId = p.stream.readUnsignedWord();
            int buttonId2 = 0;
            if (packetId == 233 || packetId == 21 || packetId == 169 || packetId == 232 || packetId == 214 || packetId == 90) {
                buttonId2 = p.stream.readUnsignedWord();
            }
            if (buttonId2 == 65535) {
                buttonId2 = 0;
            }
            switch (interfaceId) {
                case 620:
                case 621:
                    Engine.shopHandler.handleoption(p,interfaceId,buttonId,buttonId2,packetId);
                    break;

    Of course you dont have to replace it, but you can if you dont know how to call the packets once the buttons have been pressed.

    Step 3.

    Now we have done all that, we are going to need to make a ShopHandler.java.
    note.ifyouhave a shophandler.java file miss step 3
    This is to be placed at:

    Code:

    palidino76.rs2.Content

    Code:
      }

        public void openshop(Player p, int shopid) {
            switch (shopid) {
                case 1:
                    shopopen(p, 868);
                    generalStore = true;
                    items  = Engine.shops.Generalshoplumb;
                    itemsN = Engine.shops.GeneralshoplumbN;
                    p.frames.setItems(p, -1, 64209, 93, p.items, p.itemsN);//Shop Inventory
                    p.frames.setItems(p, -1, 64271, 31, items, itemsN);//Main Stock
                break;
                case 2:
                    shopopen(p, 868);
                    generalStore = true;
                    items  = Engine.shops.Generalshopfalador;
                    itemsN = Engine.shops.GeneralshopfaladorN;
                    p.frames.setItems(p, -1, 64209, 93, p.items, p.itemsN);//Shop Inventory
                    p.frames.setItems(p, -1, 64271, 31, items, itemsN);//Main Stock
                break;
              case 3:
                    shopopen(p, 868);              // shop id 868 general store.
                    generalStore = true;
                    items  = Engine.shops.Generalshopvarrock;
                    itemsN = Engine.shops.GeneralshopvarrockN;
                    p.frames.setItems(p, -1, 64209, 93, p.items, p.itemsN);//Shop Inventory
                    p.frames.setItems(p, -1, 64271, 31, items, itemsN);//Main Stock          //set to 32 to be in playerstock
                break;
            }

        }
    }

    This is the main part of the whole tutorial because here we can add shops which will be called from Shops.java.

    Step 4.

    Now we have to create a file called Shops.java.
    note. if you have shops.java skip this step
    This is to be put into:

    Code:
    palidino76.rs2.Content

    Code:
    /**
     * Created by IntelliJ IDEA.
     * User: Sere
     * Date: 6-mrt-2009
     * Time: 10:33:19
     */
    public class Shops {
            public int maxItems = 40;
        /*init shops */
            public int[] Generalshoplumb            = new int[maxItems];
            public int[] GeneralshoplumbN          = new int[maxItems];
            public int[] Generalshopvarrock        = new int[maxItems];
            public int[] GeneralshopvarrockN        = new int[maxItems];
            public int[] Generalshopfalador        = new int[maxItems];
            public int[] GeneralshopfaladorN        = new int[maxItems];
        /*init shops */
        public Shops() {

            System.out.println("[ loaded shops ]");
            /**
            * this sets the shops empty
              */

        for (int i = 0; i < 40; i++) {

            Generalshoplumb[i]          =-1;
            Generalshopvarrock[i]      =-1;
            Generalshopfalador[i]      =-1;
        }


    }
    }

    Now here we can create new shops, basically adding the items to the shop.

    For example, i have made a custom shop with Rares in it.

    Code:
      public int[] RaresShop            = {1038, 1040, 1042, 1044, 1046, 1048, 1050, 2651, 8928, 8959, 8960, 8961, 8962, 8963, 8964, 8965, 13**** 1053, 1055, 1057};  // the items
            public int[] RaresShopN          =  {50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50};  // the amout

    This is the place to insert the item id:

    Code:
    public int[] RaresShop

    And this is the place to insert the amount of the same item to be inserted into the shop:

    Code:
    public int[] RaresShopN

    How do i open shops on my server?

    Code:
    Engine.shopHandler.openshop(p, 4);

    All you have to do to open a shop on your server is add the above code to where you desire...
    So if you were doing it in NpcOption1.java then you can simply do:


    Code:

    case 520: // Npc id
          Engine.shopHandler.openshop(p, 4);
    break;

      Current date/time is Tue May 07, 2024 9:30 am