Welcome!

Join our community of MMORPG enthusiasts and private server developers! By registering, you'll gain access to in-depth discussions on source codes, binaries, and the latest developments in MMORPG server files. Collaborate with like-minded individuals, explore tutorials, and share insights on building and optimizing private servers. Join us today and unlock the full potential of MMORPG server development!

Join Today!

[TuT - 508] 99% Shopping

Joined
Jan 23, 2007
Messages
2,605
Reaction score
360
Location
England, UK
Difficulty: 2/10

Base: Palidinos Normal 508 base...

Description:

This is to add shops with the correct interface to your 508 server. This was coded 100% to serenity and all credits on on this tutorial go to him!

Why is it only 99%, Why not 100%?

It's 99% because of one reason, and that is because the "Buy X" button will not work, unless coded by someone else and released.. Also i dont know if it's me that has this problem, but when you access the shop it does not change to the inventory with the items in..
But yeh that's about it really.

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.
This is to be placed at:

Code:
palidino76.rs2.Content

Code:
package palidino76.rs2.Content;

import palidino76.rs2.players.Player;
import palidino76.rs2.players.items.PlayerItems;
import palidino76.rs2.Engine;

/**
 * Created by IntelliJ IDEA.
 * User:     Serenty
 * Date:     3-march-2009
 * Project:  Boneyard
 * Time:     19:51:15
 */
public class ShopHandler {


    Player p;
    PlayerItems pi = new PlayerItems();
    public int maxItems = 40;
    public int[] items = new int[maxItems];
    public int[] itemsN = new int[maxItems];
    public int[] maxItemAmount = new int[maxItems];
    public boolean generalStore = false;
    public long lastRestock = System.currentTimeMillis();
    int shopid = 0;
    public boolean mainstock = true;
    /***************************************************************************************************************/
    /*                              DO NOT TOUCH THIS!                                                             */
    /***************************************************************************************************************/
    public ShopHandler() {


        for (int i = 0; i < 40; i++) {
            items[i] = -1;

        }

        this.items = items;
        this.itemsN = itemsN;
        maxItemAmount = itemsN;
    }

    public void process(Player p) {
        if (System.currentTimeMillis() - lastRestock >= 60000) {
            clearSlots(p);
            for (int i = 0; i < items.length; i++) {
                if (itemsN[i] < maxItemAmount[i]) itemsN[i]++;
            }
            lastRestock = System.currentTimeMillis();
        }
    }

    public void sell(Player p, int item, int amnt){
            PlayerItems pi = new PlayerItems();
            boolean shopShouldBuy = generalStore || isItemOnShop(item);
            if (!shopShouldBuy) {
                p.frames.sendMessage(p, "You cannot sell this item to this shop.");
                return;
            }
            if (item == 995) {
                p.frames.sendMessage(p, "You can't sell coins to a shop");
                return;
            }
            int free = findFreeSlot();
            if (!isItemOnShop(item) && generalStore) {
                if (free == -1) {
                    p.frames.sendMessage(p, "This shop is full.");
                    return;
                }
                items[free] = item;
                itemsN[free] = 0;
            }
            int slot = findItemSlot(item);
        if(amnt<=pi.invItemCount(p,item))
        {
            if (itemStacks(item)) {
                items[slot] = item;
                itemsN[slot] += amnt;
                pi.deleteItem(p, item, pi.getItemSlot(p, item), amnt);
                    pi.addItem(p, 995, amnt*itemValue(item));
            } else {
                items[slot] = item;
                for (int notused = amnt; notused > 0; notused--) {
                    pi.deleteItem(p, item, pi.getItemSlot(p, item), 1);
                    pi.addItem(p, 995, itemValue(item));
                    itemsN[slot]++;
                }
            }
        }
        else
        {
            amnt = pi.invItemCount(p,item);
            if (itemStacks(item)) {
                items[slot] = item;
                itemsN[slot] += amnt;
                pi.deleteItem(p, item, pi.getItemSlot(p, item), amnt);
                    pi.addItem(p, 995, amnt*itemValue(item));
            } else {
                items[slot] = item;
                for (int notused = amnt; notused > 0; notused--) {
                    pi.deleteItem(p, item, pi.getItemSlot(p, item), 1);
                    pi.addItem(p, 995, itemValue(item));
                    itemsN[slot]++;
                }
            }
        }


            sendShopItems(p);
            sendPlayerInventory(p);
        }

    public void buy(Player p, int item, int amnt) {
        clearSlots(p);
        int slot = findItemSlot(item);
        if (slot == -1) {
            return;
        }
        if (itemsN[slot] < amnt) amnt = itemsN[slot];
        if (amnt == 0) {

            items[slot] = -1;


            p.frames.sendMessage(p, "That item's stock has run out.");
            return;
        }
        if (itemStacks(item)) {                                                 // item stackable, easier...
            if (pi.freeSlotCount(p) < 1) {
                p.frames.sendMessage(p, "Not enough space on inventory");
                return;
            }
            if (pi.invItemCount(p, 995) < (amnt * itemValue(item))) {
                p.frames.sendMessage(p, "Not enough coins to buy that many.");
                return;
            }
            pi.deleteItem(p, 995, pi.getItemSlot(p, 995), amnt * itemValue(item));
            pi.addItem(p, item, amnt);
            itemsN[slot] -= amnt;

        } else {                                                                // item not stackable
            for (int i = amnt; i > 0; i--) {
                int price = itemValue(item);
                clearSlots(p);
                if (pi.invItemCount(p, 995) < price) {
                    p.frames.sendMessage(p, "Not enough coins to buy that many.");
                    break;
                }
                if (pi.findInvSlot(p) == -1) {
                    p.frames.sendMessage(p, "Not enough space on inventory");
                    break;
                }
                if (itemsN[slot] < 1) {
                    clearSlots(p);
                    p.frames.sendMessage(p, "The shop has run out of stock from this item!");
                    break;
                }
                if (itemsN[slot] == 1) {
                    pi.deleteItem(p, 995, pi.getItemSlot(p, 995), price);
                    pi.addItem(p, item, 1);
                    items[slot] = -1;

                    break;
                }
                itemsN[slot]--;

                pi.deleteItem(p, 995, pi.getItemSlot(p, 995), price);
                pi.addItem(p, item, 1);
                clearSlots(p);

            }


        }

        sendShopItems(p);
        sendPlayerInventory(p);
        clearSlots(p);
    }

    public void buystock(Player p, int item, int amnt) {
        if (itemStacks(item)) {                                                 // item stackable, easier...
            if (pi.freeSlotCount(p) < 1) {
                p.frames.sendMessage(p, "Not enough space on inventory");
                return;
            }
            if (pi.invItemCount(p, 995) < (amnt * itemValue(item))) {
                p.frames.sendMessage(p, "Not enough coins to buy that many.");
                return;
            }
            pi.deleteItem(p, 995, pi.getItemSlot(p, 995), amnt * itemValue(item));
            pi.addItem(p, item, amnt);

        } else {
            // item not stackable
            for (int i = amnt; i > 0; i--) {
                int price = itemValue(item);
                if (pi.invItemCount(p, 995) < price) {
                    p.frames.sendMessage(p, "Not enough coins to buy that many.");
                    break;
                }
                if (pi.findInvSlot(p) == -1) {
                    p.frames.sendMessage(p, "Not enough space on inventory");
                    break;
                }
                pi.deleteItem(p, 995, pi.getItemSlot(p, 995), price);
                pi.addItem(p, item, 1);
            }
        }
        //sendShopItems(p);
        sendPlayerInventory(p);

    }

    public int findItemSlot(int item) {
        for (int i = 0; i < items.length; i++)
            if (item == items[i]) return i;
        return -1;
    }

    public int findFreeSlot() {
        for (int i = 0; i < items.length; i++)
            if (items[i] == -1) return i;
        return -1;
    }

    public void clearSlots(Player p) {
        for (int i = 0; i < items.length; i++)
            if (items[i] < 1) {
                items[i] = -1;
            } else {
            }

    }

    public void sendShopItems(Player p) {
        p.frames.setItems(p, -1, 64271, 31, items, itemsN);
    }

    public boolean isItemOnShop(int item) {
        return findItemSlot(item) != -1;
    }

    public void sendPlayerInventory(Player p) {
        p.frames.setItems(p, -1, 64209, 93, p.items, p.itemsN);

    }

    public int itemValue(int item) {
        return Engine.items.itemLists[item].shopValue;
    }

    public boolean itemStacks(int item) {
        return Engine.items.itemLists[item].itemStackable;
    }

    public void handleoption(Player p, int interfaceId, int buttonId, int buttonId2, int packetId) {
        switch (interfaceId) {
            case 620:
                if (buttonId == 25) {
                    p.frames.setInterfaceConfig(p, 620, 23, false);
                    p.frames.setInterfaceConfig(p, 620, 24, true);
                    p.frames.setInterfaceConfig(p, 620, 29, false);
                    p.frames.setInterfaceConfig(p, 620, 25, true);
                    p.frames.setInterfaceConfig(p, 620, 27, true);
                    p.frames.setInterfaceConfig(p, 620, 26, false);
                    p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
                    mainstock = true;
                }
                if (buttonId == 26) {
                    p.frames.setInterfaceConfig(p, 620, 23, true);
                    p.frames.setInterfaceConfig(p, 620, 24, false);
                    p.frames.setInterfaceConfig(p, 620, 29, true);
                    p.frames.setInterfaceConfig(p, 620, 25, false);
                    p.frames.setInterfaceConfig(p, 620, 27, false);
                    p.frames.setInterfaceConfig(p, 620, 26, true);
                    p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
                    mainstock = false;

                }
                PlayerItems pi = new PlayerItems();

                if (buttonId == 23) {
                    int itemid = returnItemId(shopid, buttonId2);
                    switch (packetId) {
                        case 233:
                            /* Value. */
                            p.frames.sendMessage(p, "this item costs " + Engine.items.getItemValue(itemid) + " coins.");
                            break;
                        case 21:
                            /* Buy 1. */
                            buystock(p, itemid, 1);
                            break;
                        case 169:
                            /* Buy 5. */
                            buystock(p, itemid, 5);
                            break;
                        case 214:
                            /* Buy 10. */
                            buystock(p, itemid, 10);
                            break;
                        case 173:
                            /* Buy 50. */
                            buystock(p, itemid, 50);
                            break;
                        case 232:
                            /*Examine. */
                            p.frames.sendMessage(p, Engine.items.getItemDescription(itemid));
                            break;
                    }
                }
                if (buttonId == 24) {
                    int itemid = items[buttonId2];


                    switch (packetId) {
                        case 233:
                            /* Value. */
                            p.frames.sendMessage(p, "this item costs " + Engine.items.getItemValue(itemid) + " coins.");
                            break;
                        case 21:
                            /* Buy 1. */
                            buy(p, itemid, 1);
                            break;
                        case 169:
                            /* Buy 5. */
                            buy(p, itemid, 5);
                            break;
                        case 214:
                            /* Buy 10. */
                            buy(p, itemid, 10);
                            break;
                        case 173:
                            /* Buy 50. */
                            buy(p, itemid, 50);
                            break;
                        case 90:
                            /*Examine. */
                            p.frames.sendMessage(p, Engine.items.getItemDescription(itemid));
                            break;
                    }


                }
                break;
            case 621:
                if (buttonId == 0) {
                    int itemid = p.items[buttonId2];

                    switch (packetId) {
                        case 233:
                            /*Value.*/
                            p.frames.sendMessage(p, "this item is wourth " + Engine.items.getItemValue(itemid) + " coins.");
                            break;
                        case 21:
                            /*
                            * Buy 1.
                            */
                            sell(p, itemid, 1);
                            break;
                        case 169:
                            /*
                            * Buy 5.
                            */
                            sell(p, itemid, 5);
                            break;
                        case 214:
                            /*
                            * Buy 10.
                            */

                            sell(p, itemid, 10);
                            break;
                        case 173:
                            /*
                            * Buy 50.
                            */
                            sell(p, itemid, 50);
                            break;
                        case 90:
                            /*
                            * Examine.
                            */
                            p.frames.sendMessage(p, Engine.items.getItemDescription(itemid));
                            break;
                    }
                }
                break;
        }
    }

    public void shopopen(Player p, int shopId) {
        p.frames.removeShownInterface(p);
        p.frames.showInterface(p, 620); //Shop
        p.frames.setInventory(p, 621);
        p.frames.setTab(p, 80, 621);//Inv
        shopid = shopId;
        Object[] setshopparams = new Object[]{shopId, 93};

        int shi = 621 << 16;
        int ship = (620 << 16) + 24;

        Object[] invparams = new Object[]{"", "", "", "", "Sell X", "Sell 10", "Sell 5", "Sell 1", "Value", -1, 0, 7, 4, 93, shi};
        Object[] shopparams = new Object[]{"", "", "", "", "Buy X", "Buy 10", "Buy 5", "Buy 1", "Value", -1, 0, 4, 10, 31, ship};

        p.frames.runScript(p, 25, setshopparams, "vg");//Loads main stock items
        p.frames.runScript(p, 150, invparams, "IviiiIsssssssss");
        p.frames.runScript(p, 150, shopparams, "IviiiIsssssssss");
        p.frames.setAccessMask(p, 1278, 0, 621, 0, 28);

        if (mainstock) {
            p.frames.setInterfaceConfig(p, 620, 23, false);
            p.frames.setInterfaceConfig(p, 620, 24, true);
            p.frames.setInterfaceConfig(p, 620, 29, false);
            p.frames.setInterfaceConfig(p, 620, 25, true);
            p.frames.setInterfaceConfig(p, 620, 27, true);
            p.frames.setInterfaceConfig(p, 620, 26, false);
            p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
        } else {
            p.frames.setInterfaceConfig(p, 620, 23, true);
            p.frames.setInterfaceConfig(p, 620, 24, false);
            p.frames.setInterfaceConfig(p, 620, 29, true);
            p.frames.setInterfaceConfig(p, 620, 25, false);
            p.frames.setInterfaceConfig(p, 620, 27, false);
            p.frames.setInterfaceConfig(p, 620, 26, true);
            p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);

        }
    }

    /***************************************************************************************************************/
    /*                              ONLY EDIT THIS!                                                                */
    /***************************************************************************************************************/



    public int returnItemId(int shopid, int buttonId2) {
        switch (shopid) {
            case 868:
                switch (buttonId2) {
                    case 0:return 1931;
                    case 1:return 1935;
                    case 2:return 1735;
                    case 3:return 1925;
                    case 4:return 1923;
                    case 5:return 1887;
                    case 6:return 590;
                    case 7:return 1755;
                    case 8:return 2347;
                    case 9:return 550;
                    case 10:return 9003;
                }
                break;
            case 2:
                switch (buttonId2) {
                    case 0:return 1931;
                    case 1:return 1935;
                    case 2:return 1735;
                    case 3:return 1925;
                    case 4:return 1923;
                    case 5:return 1887;
                    case 6:return 590;
                    case 7:return 1755;
                    case 8:return 2347;
                    case 9:return 550;
                    case 10:return 9003;
                }
                break;
        }
        return -1;


    }

    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.
This is to be put into:

Code:
palidino76.rs2.Content

Code:
package palidino76.rs2.Content;

/**
 * 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;

How do i make it automatically show Player Stock?

To make it so when you click on the NPC and it automatically goes to the Player Stock instead of Main stock, simply do the following..
In ShopHandler.java with the cases, add this..

Code:
		case 4: // Shop Case
                p.frames.setShop(p, 700); // 700 is the Shop ID
                items = Engine.shops.RaresShop; // Declaring this from Shops.java
                itemsN = Engine.shops.RaresShopN; // Declaring this from Shops.java
                p.frames.setItems(p, -1, 64209, 93, p.items, p.itemsN); 
                p.frames.setItems(p, -1, 64271, 31, items, itemsN);
            	break;

I've explained what the code does using comments..

Then add these in Engine.java
Code:
public static ShopHandler shopHandler = new ShopHandler();
public static Shops     shops                  = new Shops();

If you get any errors you could also try importing this into Engine.java

Code:
import palidino76.rs2.content.*; // Please make sure Content is upper or lower case in your files...

Pictures of the Shops..

Joe9099 - [TuT - 508] 99% Shopping - RaGEZONE Forums

Joe9099 - [TuT - 508] 99% Shopping - RaGEZONE Forums

Joe9099 - [TuT - 508] 99% Shopping - RaGEZONE Forums


Credits: Serenity 100% for code.

No credits to me but i did write this tutorial, hope you can figure it out!

BTW IM ALWAYSSTUCK1 ON R-SERVER!! meh...
+
i asked serenity if i could post it here. And he approved, so yeh enjoy...

ps. You will get import errors, just fix them if you know what your doing..
 
I keep getting these errors.. Any1 know how to fix?

^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\io\packets\ActionButtons.java:2494: reached end of file while parsing
}
^
.\RS2\content\ShopHandler.java:267: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:277: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:406: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 25, setshopparams, "vg");//Loads main stock items
^
.\RS2\content\ShopHandler.java:407: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 150, invparams, "IviiiIsssssssss");
^
.\RS2\content\ShopHandler.java:408: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 150, shopparams, "IviiiIsssssssss");
^
.\RS2\content\ShopHandler.java:409: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 0, 621, 0, 28);
^
.\RS2\content\ShopHandler.java:418: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:426: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
^
.\RS2\io\packets\ActionButtons.java:1763: cannot find symbol
symbol : variable m
location: class RS2.io.packets.ActionButtons
m.modernMagicAB(p, buttonId);
^
.\RS2\io\packets\ActionButtons.java:1766: cannot find symbol
symbol : variable m
location: class RS2.io.packets.ActionButtons
m.ancientMagicAB(p, buttonId);
^
14 errors
.\RS2\io\packets\ActionButtons.java:2494: reached end of file while parsing
}
^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\io\packets\ActionButtons.java:1763: cannot find symbol
symbol : variable m
location: class RS2.io.packets.ActionButtons
m.modernMagicAB(p, buttonId);
^
.\RS2\io\packets\ActionButtons.java:1766: cannot find symbol
symbol : variable m
location: class RS2.io.packets.ActionButtons
m.ancientMagicAB(p, buttonId);
^
.\RS2\content\ShopHandler.java:267: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:277: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:406: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 25, setshopparams, "vg");//Loads main stock items
^
.\RS2\content\ShopHandler.java:407: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 150, invparams, "IviiiIsssssssss");
^
.\RS2\content\ShopHandler.java:408: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 150, shopparams, "IviiiIsssssssss");
^
.\RS2\content\ShopHandler.java:409: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 0, 621, 0, 28);
^
.\RS2\content\ShopHandler.java:418: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:426: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
^
14 errors
.\RS2\.\io\packets\ActionButtons.java:2494: reached end of file while parsing
}
^
1 error
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\io\packets\ActionButtons.java:2494: reached end of file while parsing
}
^
.\RS2\content\ShopHandler.java:267: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:277: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:406: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 25, setshopparams, "vg");//Loads main stock items
^
.\RS2\content\ShopHandler.java:407: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 150, invparams, "IviiiIsssssssss");
^
.\RS2\content\ShopHandler.java:408: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 150, shopparams, "IviiiIsssssssss");
^
.\RS2\content\ShopHandler.java:409: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 0, 621, 0, 28);
^
.\RS2\content\ShopHandler.java:418: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:426: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
^
.\RS2\io\packets\ActionButtons.java:1763: cannot find symbol
symbol : variable m
location: class RS2.io.packets.ActionButtons
m.modernMagicAB(p, buttonId);
^
.\RS2\io\packets\ActionButtons.java:1766: cannot find symbol
symbol : variable m
location: class RS2.io.packets.ActionButtons
m.ancientMagicAB(p, buttonId);
^
14 errors
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\content\Shops.java:18: illegal start of expression
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

^
.\RS2\io\packets\ActionButtons.java:2494: reached end of file while parsing
}
^
.\RS2\content\ShopHandler.java:267: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:277: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:406: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 25, setshopparams, "vg");//Loads main stock items
^
.\RS2\content\ShopHandler.java:407: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 150, invparams, "IviiiIsssssssss");
^
.\RS2\content\ShopHandler.java:408: cannot find symbol
symbol : method runScript(RS2.players.Player,int,java.lang.Object[],java.lang.S
tring)
location: class RS2.io.Frames
p.frames.runScript(p, 150, shopparams, "IviiiIsssssssss");
^
.\RS2\content\ShopHandler.java:409: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 0, 621, 0, 28);
^
.\RS2\content\ShopHandler.java:418: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
^
.\RS2\content\ShopHandler.java:426: cannot find symbol
symbol : method setAccessMask(RS2.players.Player,int,int,int,int,int)
location: class RS2.io.Frames
p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
^
.\RS2\io\packets\ActionButtons.java:1763: cannot find symbol
symbol : variable m
location: class RS2.io.packets.ActionButtons
m.modernMagicAB(p, buttonId);
^
.\RS2\io\packets\ActionButtons.java:1766: cannot find symbol
symbol : variable m
location: class RS2.io.packets.ActionButtons
m.ancientMagicAB(p, buttonId);
^
14 errors
Press any key to continue . . .
 
Hey guys, I just followed this tutorial, but it don't work for me.


I had no errors on my compiler but it still don't work.

I changed the Imports to the correct files/folders, but still nothing.


I was thinking that i might have put the Npc ID In the wrong place in the file, thats why the shop won't open.


Could somone please Clearly explain were, and what i have to type for the Npc ID.


Please, explain what files it goes in, what I have to type, and maybe an example including an example Npc ID.



Also, you can E-mail me at -

Gamedit.com127751@yahoo.com
 
OMFG! Guys c'mon please respond back.


I made a case Called Case 7967:

on the compiler that it was "Orphaned" and i dont even know how to fix it.

Thats the only error i got was Orphaned Case: Case 7967:


Please help.
 
-leeches for evolutionscape-
-misses out creds on purpose-
-says "Ah well, hes on the development team, who cares?!"-
-laughs, noob codings-
-shoutrs "HAHAHA NUBS LEECH DISSSS"-

Ok yeh, nice release Joe :D
 
Last edited:
Hi I have everything working and I have been able to fix all of my mistake while doing this except this one...

Code:
.\bulby\.\Engine.java:143: cannot access Bulby.content.ShopHandler
bad class file: .\Bulby\content\ShopHandler.java
file does not contain class Bulby.content.ShopHandler
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\Bulby\Engine.java:143: cannot access Bulby.content.ShopHandler
bad class file: .\Bulby\content\ShopHandler.java
file does not contain class Bulby.content.ShopHandler
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\Bulby\Engine.java:143: cannot access Bulby.content.ShopHandler
bad class file: .\Bulby\content\ShopHandler.java
file does not contain class Bulby.content.ShopHandler
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\Bulby\Engine.java:143: cannot access Bulby.content.ShopHandler
bad class file: .\Bulby\content\ShopHandler.java
file does not contain class Bulby.content.ShopHandler
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\Bulby\Engine.java:143: cannot access Bulby.content.ShopHandler
bad class file: .\Bulby\content\ShopHandler.java
file does not contain class Bulby.content.ShopHandler
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\Bulby\io\packets\ActionButtons.java:2495: reached end of file while parsing
}
 ^
.\Bulby\Engine.java:143: cannot access Bulby.content.ShopHandler
bad class file: .\Bulby\content\ShopHandler.java
file does not contain class Bulby.content.ShopHandler
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\bulby\.\io\packets\ActionButtons.java:2495: reached end of file while parsing
}
 ^
1 error
.\Bulby\Engine.java:143: cannot access Bulby.content.ShopHandler
bad class file: .\Bulby\content\ShopHandler.java
file does not contain class Bulby.content.ShopHandler
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\Bulby\Engine.java:143: cannot access Bulby.content.ShopHandler
bad class file: .\Bulby\content\ShopHandler.java
file does not contain class Bulby.content.ShopHandler
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
Press any key to continue . . .

What am I doing wrong?
 
What am I doing wrong?

For the "end of file parsing }" make sure you have copied out the code from Joe LETTER FOR LETTER. In this case, you have missed out a bracket or two somewhere.

I need help too...

I am using the same source, but I can't seem to import correctly the content folder. When I first downloaded it, there was no content folder, and had to make my own. I have followed Joe's tut, but when I compile it, the cmd reads:

Code:
.\palidino76\rs2\Engine.java:14: package palidino76.rs2.content does not exist
import palidino76.rs2.content.*; // Please make sure Content is upper or lower c
ase in your files...
^
.\palidino76\rs2\Engine.java:29: cannot find symbol
symbol  : class ShopHandler
location: class palidino76.rs2.Engine
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\palidino76\rs2\Engine.java:30: cannot find symbol
symbol  : class Shops
location: class palidino76.rs2.Engine
        public static Shops     shops                  = new Shops();
                      ^
.\palidino76\rs2\Engine.java:29: cannot find symbol
symbol  : class ShopHandler
location: class palidino76.rs2.Engine
        public static ShopHandler shopHandler = new ShopHandler();
                                                    ^
.\palidino76\rs2\Engine.java:30: cannot find symbol
symbol  : class Shops
location: class palidino76.rs2.Engine
        public static Shops     shops                  = new Shops();
                                                             ^
5 errors
Press any key to continue . . .

The Engine.java file reads:
Code:
// More code above - this comment is for the purposes of the forum.
import palidino76.rs2.content.*; // Please make sure Content is upper or lower case in your files...
import palidino76.rs2.players.Player;
import palidino76.rs2.players.items.*;
import palidino76.rs2.players.update.*;
import palidino76.rs2.players.combat.PlayerCombat;
import palidino76.rs2.world.mapdata.MapData;
import palidino76.rs2.world.items.Items;
import palidino76.rs2.io.*;
import palidino76.rs2.util.Misc;
import palidino76.rs2.npcs.NPC;
import palidino76.rs2.npcs.update.*;
import palidino76.rs2.npcs.loading.*;

public class Engine implements Runnable {

	public static ShopHandler shopHandler = new ShopHandler();
	public static Shops shops = new Shops();
// More code below - this comment is for the purposes of the forum.
And my explorer path is:
...Palidino 508\Server 508\src\palidino76\rs2\content
with shopHandler.java and Shops.java
 
For the "end of file parsing }" make sure you have copied out the code from Joe LETTER FOR LETTER. In this case, you have missed out a bracket or two somewhere.

I need help too...

I am using the same source, but I can't seem to import correctly the content folder. When I first downloaded it, there was no content folder, and had to make my own. I have followed Joe's tut, but when I compile it, the cmd reads:

Code:
.\palidino76\rs2\Engine.java:14: package palidino76.rs2.content does not exist
import palidino76.rs2.content.*; // Please make sure Content is upper or lower c
ase in your files...
^
.\palidino76\rs2\Engine.java:29: cannot find symbol
symbol  : class ShopHandler
location: class palidino76.rs2.Engine
        public static ShopHandler shopHandler = new ShopHandler();
                      ^
.\palidino76\rs2\Engine.java:30: cannot find symbol
symbol  : class Shops
location: class palidino76.rs2.Engine
        public static Shops     shops                  = new Shops();
                      ^
.\palidino76\rs2\Engine.java:29: cannot find symbol
symbol  : class ShopHandler
location: class palidino76.rs2.Engine
        public static ShopHandler shopHandler = new ShopHandler();
                                                    ^
.\palidino76\rs2\Engine.java:30: cannot find symbol
symbol  : class Shops
location: class palidino76.rs2.Engine
        public static Shops     shops                  = new Shops();
                                                             ^
5 errors
Press any key to continue . . .

The Engine.java file reads:
Code:
// More code above - this comment is for the purposes of the forum.
import palidino76.rs2.content.*; // Please make sure Content is upper or lower case in your files...
import palidino76.rs2.players.Player;
import palidino76.rs2.players.items.*;
import palidino76.rs2.players.update.*;
import palidino76.rs2.players.combat.PlayerCombat;
import palidino76.rs2.world.mapdata.MapData;
import palidino76.rs2.world.items.Items;
import palidino76.rs2.io.*;
import palidino76.rs2.util.Misc;
import palidino76.rs2.npcs.NPC;
import palidino76.rs2.npcs.update.*;
import palidino76.rs2.npcs.loading.*;

public class Engine implements Runnable {

	public static ShopHandler shopHandler = new ShopHandler();
	public static Shops shops = new Shops();
// More code below - this comment is for the purposes of the forum.
And my explorer path is:
...Palidino 508\Server 508\src\palidino76\rs2\content
with shopHandler.java and Shops.java

Ok, let me help you with this. If you were to actually read your command prompt, you would see that the error is that the CLASS file does not exist. In other words, you only have the JAVA files. To fix this, you normally need to drag it to your javac.exe in your java files.

I also have a problem.

Code:
rs2\Engine.java:64: cannot find symbol
symbol  : class ShopHandler
location: class palidino76.rs2.Engine
public static ShopHandler shopHandler = new ShopHandler();
              ^
rs2\Engine.java:65: cannot find symbol
symbol  : class Shops
location: class palidino76.rs2.Engine
public static Shops shops = new Shops();
              ^
rs2\Engine.java:64: cannot find symbol
symbol  : class ShopHandler
location: class palidino76.rs2.Engine
public static ShopHandler shopHandler = new ShopHandler();
                                            ^
rs2\Engine.java:65: cannot find symbol
symbol  : class Shops
location: class palidino76.rs2.Engine
public static Shops shops = new Shops();
                                ^
rs2\ShopHandler.java:267: cannot find symbol
symbol  : method setAccessMask(palidino76.rs2.players.Player,int,int,int,int,int
)
location: class palidino76.rs2.io.Frames
                    p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
                            ^
rs2\ShopHandler.java:277: cannot find symbol
symbol  : method setAccessMask(palidino76.rs2.players.Player,int,int,int,int,int
)
location: class palidino76.rs2.io.Frames
                    p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
                            ^
rs2\ShopHandler.java:406: cannot find symbol
symbol  : method runScript(palidino76.rs2.players.Player,int,java.lang.Object[],
java.lang.String)
location: class palidino76.rs2.io.Frames
        p.frames.runScript(p, 25, setshopparams, "vg");//Loads main stock items
                ^
rs2\ShopHandler.java:407: cannot find symbol
symbol  : method runScript(palidino76.rs2.players.Player,int,java.lang.Object[],
java.lang.String)
location: class palidino76.rs2.io.Frames
        p.frames.runScript(p, 150, invparams, "IviiiIsssssssss");
                ^
rs2\ShopHandler.java:408: cannot find symbol
symbol  : method runScript(palidino76.rs2.players.Player,int,java.lang.Object[],
java.lang.String)
location: class palidino76.rs2.io.Frames
        p.frames.runScript(p, 150, shopparams, "IviiiIsssssssss");
                ^
rs2\ShopHandler.java:409: cannot find symbol
symbol  : method setAccessMask(palidino76.rs2.players.Player,int,int,int,int,int
)
location: class palidino76.rs2.io.Frames
        p.frames.setAccessMask(p, 1278, 0, 621, 0, 28);
                ^
rs2\ShopHandler.java:418: cannot find symbol
symbol  : method setAccessMask(palidino76.rs2.players.Player,int,int,int,int,int
)
location: class palidino76.rs2.io.Frames
            p.frames.setAccessMask(p, 1278, 23, 620, 0, 40);
                    ^
rs2\ShopHandler.java:426: cannot find symbol
symbol  : method setAccessMask(palidino76.rs2.players.Player,int,int,int,int,int
)
location: class palidino76.rs2.io.Frames
            p.frames.setAccessMask(p, 1278, 24, 620, 0, 40);
                    ^
12 errors
Press any key to continue . . .

I can see that I'm missing a lot of methods in my Frames.java. But my real issue is the same that Aphelion5 had, I cannot supply my CLASS files. I was able to create Shops.java straight from javac.exe, but I could not do the same with ShopHandler. I'm sure a lot of this is because of the missing methods.
 
Thanks for this im going to use i think! good job!
 
Back