Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • ASDss: where do u download source and clients now
      August 18, 2017, 10:39:31 PM
    • ASDss: yo
      August 18, 2017, 10:39:20 PM
    • dan v jad: click me 4 da fun ;)[link]
      August 18, 2017, 04:39:58 PM
    • stCky: Palidinho is your OpenGL (was it OpenGL?) stuff open source anywhere?
      August 16, 2017, 09:07:22 PM
    • Travas:BUILD THE WALL
      August 15, 2017, 09:28:49 PM
    • Travas: i have ass cancer
      August 15, 2017, 09:23:29 PM
    • stCky: what are the fudge are you tryna ask?
      August 15, 2017, 08:21:35 PM
    • bader: what are the rsps community alive ?
      August 15, 2017, 05:46:16 PM
    • bader: yo guys
      August 15, 2017, 05:46:08 PM
    • Spacehost:[link] Updated our thread :)
      August 15, 2017, 09:40:34 AM
    • Adaro: The client is in Download section at Homepage
      August 15, 2017, 01:09:20 AM
    • FaTe_Of_GoDs: where do i get the client?????????????
      August 14, 2017, 05:23:14 PM
    • stCky: can anyone help me? I cant login to the shoutbox
      August 13, 2017, 05:45:15 PM
    • drubrkletern: appeal denied
      August 13, 2017, 02:35:27 PM
    • King_Trout:[link]
      August 13, 2017, 11:17:12 AM
    • Cole1497: no sorry
      August 13, 2017, 10:27:14 AM
    • ayz: yo can anyone explain something to me
      August 13, 2017, 08:08:51 AM
    • coolking12: Hi
      August 13, 2017, 04:16:06 AM
    • stCky: n+1
      August 11, 2017, 06:09:24 PM
    • PalidinoDH: How many more pages are going to show errors before this dude gets on and fixes shit
      August 11, 2017, 04:57:00 PM

    Author Topic: 718 shops fix  (Read 10480 times)

    0 Members and 1 Guest are viewing this topic.

    Offlineshabba 56

    • Member
    • ****
    • Posts: 575
    • Thanks: +0/-0
      • View Profile
    718 shops fix
    « on: July 17, 2012, 03:00:56 PM »
    This is a Tutorial from R-S by Raghav i take no credit for this just posting for mopas to share

    Shops.java

    Code: Java
    1. packagecom.rs.game.player.content;
    2.  
    3. importjava.util.HashMap;
    4. importjava.util.concurrent.CopyOnWriteArrayList;
    5.  
    6. importcom.rs.cache.loaders.ItemDefinitions;
    7. importcom.rs.game.item.Item;
    8. importcom.rs.game.player.CombatDefinitions;
    9. importcom.rs.game.player.Player;
    10. importcom.rs.game.player.Skills;
    11. importcom.rs.utils.ItemBonuses;
    12. importcom.rs.utils.ItemExamines;
    13. importcom.rs.utils.ItemSetsKeyGenerator;
    14.  
    15. publicclass Shop {
    16.  
    17.         privatestaticfinalint MAIN_STOCK_ITEMS_KEY = ItemSetsKeyGenerator
    18.                         .generateKey();
    19.  
    20.         privatestaticfinalint MAX_SHOP_ITEMS =40;
    21.         publicstaticfinalint COINS =995;
    22.  
    23.         privateString name;
    24.         private Item[] mainStock;
    25.         privateint[] defaultQuantity;
    26.         private Item[] generalStock;
    27.         privateint money;
    28.         private CopyOnWriteArrayList<Player> viewingPlayers;
    29.  
    30.         public Shop(String name, int money, Item[] mainStock, boolean isGeneralStore){
    31.                 viewingPlayers =new CopyOnWriteArrayList<Player>();
    32.                 this.name= name;
    33.                 this.money= money;
    34.                 this.mainStock= mainStock;
    35.                 defaultQuantity =newint[mainStock.length];
    36.                 for(int i =0; i < defaultQuantity.length; i++)
    37.                         defaultQuantity[i]= mainStock[i].getAmount();
    38.                 if(isGeneralStore && mainStock.length< MAX_SHOP_ITEMS)
    39.                         generalStock =new Item[MAX_SHOP_ITEMS - mainStock.length];
    40.         }
    41.  
    42.         publicboolean isGeneralStore(){
    43.                 return generalStock !=null;
    44.         }
    45.  
    46.         publicvoid addPlayer(final Player player){
    47.                 viewingPlayers.add(player);
    48.                 player.getTemporaryAttributtes().put("Shop", this);
    49.                 player.setCloseInterfacesEvent(newRunnable(){
    50.                         @Override
    51.                         publicvoid run(){
    52.                                 viewingPlayers.remove(player);
    53.                                 player.getTemporaryAttributtes().remove("Shop");
    54.                         }
    55.                 });
    56.                 player.getPackets().sendConfig(118, MAIN_STOCK_ITEMS_KEY);
    57.                 player.getPackets().sendConfig(1496, -1);
    58.                 player.getPackets().sendConfig(532, money);
    59.                 sendStore(player);
    60.                 player.getPackets().sendGlobalConfig(199, -1);
    61.                 player.getInterfaceManager().sendInterface(1265);
    62.                 for(int i =0; i < MAX_SHOP_ITEMS; i++)
    63.                         player.getPackets().sendGlobalConfig(946+ i, i < defaultQuantity.length? defaultQuantity[i]: generalStock !=null?0:-1);// prices
    64.                 player.getPackets().sendGlobalConfig(1241, 16750848);
    65.                 player.getPackets().sendGlobalConfig(1242, 15439903);
    66.                 player.getPackets().sendGlobalConfig(741, -1);
    67.                 player.getPackets().sendGlobalConfig(743, -1);
    68.                 player.getPackets().sendGlobalConfig(744, 0);
    69.                 if(generalStock !=null)
    70.                         player.getPackets().sendHideIComponent(1265, 19, false);
    71.                 player.getPackets().sendIComponentSettings(1265, 20, 0, getStoreSize()*6, 1150);
    72.                 player.getPackets().sendIComponentSettings(1265, 26, 0, getStoreSize()*6, 82903066);
    73.                 sendInventory(player);
    74.                 player.getPackets().sendIComponentText(1265, 85, name);
    75.                 player.getTemporaryAttributtes().put("shop_buying", true);
    76.                 player.getTemporaryAttributtes().put("amount_shop", 1);
    77.         }
    78.  
    79.         publicvoid sendInventory(Player player){
    80.                 player.getInterfaceManager().sendInventoryInterface(1266);
    81.                 player.getPackets().sendItems(93, player.getInventory().getItems());
    82.                 player.getPackets().sendUnlockIComponentOptionSlots(1266, 0, 0, 27, 0,
    83.                                 1, 2, 3, 4, 5);
    84.                 player.getPackets().sendInterSetItemsOptionsScript(1266, 0, 93, 4, 7,
    85.                                 "Value", "Sell 1", "Sell 5", "Sell 10", "Sell 50", "Examine");
    86.         }
    87.         //cid 67
    88.         publicvoid buy(Player player, int slotId, int quantity){
    89.                 if(slotId >= getStoreSize())
    90.                         return;
    91.                 Item item = slotId >= mainStock.length? generalStock[slotId - mainStock.length]: mainStock[slotId];
    92.                 if(item ==null)
    93.                         return;
    94.                 if(item.getAmount()==0){
    95.                         player.getPackets().sendGameMessage("There is no stock of that item at the moment.");
    96.                         return;
    97.                 }
    98.                 int dq = slotId >= mainStock.length?0: defaultQuantity[slotId];
    99.                 int price = getBuyPrice(item, dq);
    100.                 int amountCoins = player.getInventory().getItems().getNumberOf(money);
    101.                 int maxQuantity = amountCoins / price;
    102.                 int buyQ = item.getAmount()> quantity ? quantity : item.getAmount();
    103.                 boolean enoughCoins = maxQuantity >= buyQ;
    104.                 if(!enoughCoins){
    105.                         player.getPackets().sendGameMessage("You don't have enough coins.");
    106.                         buyQ = maxQuantity;
    107.                 }elseif(quantity > buyQ)
    108.                         player.getPackets().sendGameMessage(
    109.                                         "The shop has run out of stock.");
    110.                 if(item.getDefinitions().isStackable()){
    111.                         if(player.getInventory().getFreeSlots()<1){
    112.                                 player.getPackets().sendGameMessage(
    113.                                                 "Not enough space in your inventory.");
    114.                                 return;
    115.                         }
    116.                 }else{
    117.                         int freeSlots = player.getInventory().getFreeSlots();
    118.                         if(buyQ > freeSlots){
    119.                                 buyQ = freeSlots;
    120.                                 player.getPackets().sendGameMessage(
    121.                                                 "Not enough space in your inventory.");
    122.                         }
    123.                 }
    124.                 if(buyQ !=0){
    125.                         int totalPrice = price * buyQ;
    126.                         player.getInventory().deleteItem(money, totalPrice);
    127.                         player.getInventory().addItem(item.getId(), buyQ);
    128.                         item.setAmount(item.getAmount()- buyQ);
    129.                         if(item.getAmount()<=0&& slotId >= mainStock.length)
    130.                                 generalStock[slotId - mainStock.length]=null;
    131.                         refreshShop();
    132.                         sendInventory(player);
    133.                 }
    134.         }
    135.  
    136.         publicvoid restoreItems(){
    137.                 boolean needRefresh =false;
    138.                 for(int i =0; i < mainStock.length; i++){
    139.                         if(mainStock[i].getAmount()< defaultQuantity[i]){
    140.                                 mainStock[i].setAmount(mainStock[i].getAmount()+1);
    141.                                 needRefresh =true;
    142.                         }elseif(mainStock[i].getAmount()> defaultQuantity[i]){
    143.                                 mainStock[i].setAmount(mainStock[i].getAmount()+-1);
    144.                                 needRefresh =true;
    145.                         }
    146.                 }
    147.                 if(generalStock !=null){
    148.                         for(int i =0; i < generalStock.length; i++){
    149.                                 Item item = generalStock[i];
    150.                                 if(item ==null)
    151.                                         continue;
    152.                                 item.setAmount(item.getAmount()-1);
    153.                                 if(item.getAmount()<=0)
    154.                                         generalStock[i]=null;
    155.                                 needRefresh =true;
    156.                         }
    157.                 }
    158.                 if(needRefresh)
    159.                         refreshShop();
    160.         }
    161.  
    162.         privateboolean addItem(int itemId, int quantity){
    163.                 for(Item item : mainStock){
    164.                         if(item.getId()== itemId){
    165.                                 item.setAmount(item.getAmount()+ quantity);
    166.                                 refreshShop();
    167.                                 returntrue;
    168.                         }
    169.                 }
    170.                 if(generalStock !=null){
    171.                         for(Item item : generalStock){
    172.                                 if(item ==null)
    173.                                         continue;
    174.                                 if(item.getId()== itemId){
    175.                                         item.setAmount(item.getAmount()+ quantity);
    176.                                         refreshShop();
    177.                                         returntrue;
    178.                                 }
    179.                         }
    180.                         for(int i =0; i < generalStock.length; i++){
    181.                                 if(generalStock[i]==null){
    182.                                         generalStock[i]=new Item(itemId, quantity);
    183.                                         refreshShop();
    184.                                         returntrue;
    185.                                 }
    186.                         }
    187.                 }
    188.                 returnfalse;
    189.         }
    190.  
    191.         publicvoid sell(Player player, int slotId, int quantity){
    192.                 if(player.getInventory().getItemsContainerSize()< slotId)
    193.                         return;
    194.                 Item item = player.getInventory().getItem(slotId);
    195.                 if(item ==null)
    196.                         return;
    197.                 int originalId = item.getId();
    198.                 if(item.getDefinitions().isNoted())
    199.                         item =new Item(item.getDefinitions().getCertId(), item.getAmount());
    200.                 if(item.getDefinitions().isDestroyItem()
    201.                                 || ItemConstants.getItemDefaultCharges(item.getId())!=-1
    202.                                 ||!ItemConstants.isTradeable(item)|| item.getId()== money){
    203.                         player.getPackets().sendGameMessage("You can't sell this item.");
    204.                         return;
    205.                 }
    206.                 int dq = getDefaultQuantity(item.getId());
    207.                 if(dq ==-1&& generalStock ==null){
    208.                         player.getPackets().sendGameMessage(
    209.                                         "You can't sell this item to this shop.");
    210.                         return;
    211.                 }
    212.                 int price = getSellPrice(item, dq);
    213.                 int numberOff = player.getInventory().getItems()
    214.                                 .getNumberOf(originalId);
    215.                 if(quantity > numberOff)
    216.                         quantity = numberOff;
    217.                 if(!addItem(item.getId(), quantity)){
    218.                         player.getPackets().sendGameMessage("Shop is currently full.");
    219.                         return;
    220.                 }
    221.                 player.getInventory().deleteItem(originalId, quantity);
    222.                 player.getInventory().addItem(money, price * quantity);
    223.         }
    224.  
    225.         publicvoid sendValue(Player player, int slotId){
    226.                 if(player.getInventory().getItemsContainerSize()< slotId)
    227.                         return;
    228.                 Item item = player.getInventory().getItem(slotId);
    229.                 if(item ==null)
    230.                         return;
    231.                 if(item.getDefinitions().isNoted())
    232.                         item =new Item(item.getDefinitions().getCertId(), item.getAmount());
    233.                 if(item.getDefinitions().isNoted()||!ItemConstants.isTradeable(item)
    234.                                 || item.getId()== money){
    235.                         player.getPackets().sendGameMessage("You can't sell this item.");
    236.                         return;
    237.                 }
    238.                 int dq = getDefaultQuantity(item.getId());
    239.                 if(dq ==-1&& generalStock ==null){
    240.                         player.getPackets().sendGameMessage(
    241.                                         "You can't sell this item to this shop.");
    242.                         return;
    243.                 }
    244.                 int price = getSellPrice(item, dq);
    245.                 player.getPackets().sendGameMessage(
    246.                                 item.getDefinitions().getName()
    247.                                                 +": shop will buy for: "
    248.                                                 + price
    249.                                                 +" "
    250.                                                 + ItemDefinitions.getItemDefinitions(money).getName()
    251.                                                                 .toLowerCase()
    252.                                                 +". Right-click the item to sell.");
    253.         }
    254.  
    255.         publicint getDefaultQuantity(int itemId){
    256.                 for(int i =0; i < mainStock.length; i++)
    257.                         if(mainStock[i].getId()== itemId)
    258.                                 return defaultQuantity[i];
    259.                 return-1;
    260.         }
    261.  
    262.         publicvoid sendInfo(Player player, int clickSlot, Item[] stock){
    263.                 int slotId = clickSlot;//getSlotId(clickSlot);
    264.                 if(slotId >= getStoreSize())
    265.                         return;
    266.                 Item item = slotId >= stock.length? generalStock[slotId - stock.length]: stock[slotId];
    267.                 if(item ==null)
    268.                         return;
    269.                 player.getTemporaryAttributtes().put("ShopSelectedSlot", clickSlot);
    270.                 int dq = slotId >= stock.length?0: defaultQuantity[slotId];
    271.                 int price = getBuyPrice(item, dq);
    272.                 player.getPackets().sendGameMessage(item.getDefinitions().getName()+": current costs "+ price +" "+ ItemDefinitions.getItemDefinitions(money).getName().toLowerCase()+".");
    273.                 player.getInterfaceManager().sendInventoryInterface(449);
    274.                 player.getPackets().sendGlobalConfig(741, item.getId());
    275.                 player.getPackets().sendGlobalConfig(743, money);
    276.                 player.getPackets().sendUnlockIComponentOptionSlots(449, 15, -1, 0, 0, 1, 2, 3, 4);// unlocks buy
    277.                 player.getPackets().sendGlobalConfig(744, price);
    278.                 player.getPackets().sendGlobalConfig(745, 0);
    279.                 player.getPackets().sendGlobalConfig(746, -1);
    280.                 player.getPackets().sendGlobalConfig(168, 98);
    281.                 player.getPackets().sendGlobalString(25, ItemExamines.getExamine(item));
    282.                 player.getPackets().sendGlobalString(34, "");// quest id for some items
    283.                 int[] bonuses = ItemBonuses.getItemBonuses(item.getId());
    284.                 if(bonuses !=null){
    285.                         HashMap<Integer, Integer> requiriments = item.getDefinitions().getWearingSkillRequiriments();
    286.                         if(requiriments !=null&&!requiriments.isEmpty()){
    287.                                 String reqsText ="";
    288.                                 for(int skillId : requiriments.keySet()){
    289.                                         if(skillId >24|| skillId <0)
    290.                                                 continue;
    291.                                         int level = requiriments.get(skillId);
    292.                                         if(level <0|| level >120)
    293.                                                 continue;
    294.                                         boolean hasReq = player.getSkills().getLevelForXp(skillId)>= level;
    295.                                         reqsText +="<br>"+(hasReq ?"<col=00ff00>":"<col=ff0000>")+"Level "+ level +" "+ Skills.SKILL_NAME[skillId];
    296.                                 }
    297.                                 player.getPackets().sendGlobalString(26, "<br>Worn on yourself, requiring: "+ reqsText);
    298.                         }else
    299.                                 player.getPackets().sendGlobalString(26, "<br>Worn on yourself");
    300.                         player.getPackets().sendGlobalString(
    301.                                         35,
    302.                                         "<br>Attack<br><col=ffff00>+"
    303.                                                         + bonuses[CombatDefinitions.STAB_ATTACK]
    304.                                                         +"<br><col=ffff00>+"
    305.                                                         + bonuses[CombatDefinitions.SLASH_ATTACK]
    306.                                                         +"<br><col=ffff00>+"
    307.                                                         + bonuses[CombatDefinitions.CRUSH_ATTACK]
    308.                                                         +"<br><col=ffff00>+"
    309.                                                         + bonuses[CombatDefinitions.MAGIC_ATTACK]
    310.                                                         +"<br><col=ffff00>+"
    311.                                                         + bonuses[CombatDefinitions.RANGE_ATTACK]
    312.                                                         +"<br><col=ffff00>---"+"<br>Strength"
    313.                                                         +"<br>Ranged Strength"+"<br>Magic Damage"
    314.                                                         +"<br>Absorve Melee"+"<br>Absorve Magic"
    315.                                                         +"<br>Absorve Ranged"+"<br>Prayer Bonus");
    316.                         player.getPackets().sendGlobalString(36, "<br><br>Stab<br>Slash<br>Crush<br>Magic<br>Ranged<br>Summoning");
    317.                         player.getPackets().sendGlobalString(
    318.                                         52,
    319.                                         "<<br>Defence<br><col=ffff00>+"
    320.                                                         + bonuses[CombatDefinitions.STAB_DEF]
    321.                                                         +"<br><col=ffff00>+"
    322.                                                         + bonuses[CombatDefinitions.SLASH_DEF]
    323.                                                         +"<br><col=ffff00>+"
    324.                                                         + bonuses[CombatDefinitions.CRUSH_DEF]
    325.                                                         +"<br><col=ffff00>+"
    326.                                                         + bonuses[CombatDefinitions.MAGIC_DEF]
    327.                                                         +"<br><col=ffff00>+"
    328.                                                         + bonuses[CombatDefinitions.RANGE_DEF]
    329.                                                         +"<br><col=ffff00>+"
    330.                                                         + bonuses[CombatDefinitions.SUMMONING_DEF]
    331.                                                         +"<br><col=ffff00>+"
    332.                                                         + bonuses[CombatDefinitions.STRENGTH_BONUS]
    333.                                                         +"<br><col=ffff00>"
    334.                                                         + bonuses[CombatDefinitions.RANGED_STR_BONUS]
    335.                                                         +"<br><col=ffff00>"
    336.                                                         + bonuses[CombatDefinitions.MAGIC_DAMAGE]
    337.                                                         +"%<br><col=ffff00>"
    338.                                                         + bonuses[CombatDefinitions.ABSORVE_MELEE_BONUS]
    339.                                                         +"%<br><col=ffff00>"
    340.                                                         + bonuses[CombatDefinitions.ABSORVE_MAGE_BONUS]
    341.                                                         +"%<br><col=ffff00>"
    342.                                                         + bonuses[CombatDefinitions.ABSORVE_RANGE_BONUS]
    343.                                                         +"%<br><col=ffff00>"
    344.                                                         + bonuses[CombatDefinitions.PRAYER_BONUS]);
    345.                 }else
    346.                         player.getPackets().sendGlobalString(26, "");
    347.  
    348.         }
    349.  
    350.         publicint getBuyPrice(Item item, int dq){
    351.  
    352.                 int price = item.getDefinitions().getValue();
    353.                 if(price ==0)
    354.                         price =1;
    355.                 return price;// TODO formula
    356.         }
    357.  
    358.         publicint getSellPrice(Item item, int dq){
    359.                 return item.getDefinitions().getValue()/2;// TODO formula
    360.         }
    361.  
    362.         publicvoid sendExamine(Player player, int slotId){
    363.                 if(slotId >= getStoreSize())
    364.                         return;
    365.                 Item item = slotId >= mainStock.length? generalStock[slotId
    366.                                 - mainStock.length]: mainStock[slotId];
    367.                 if(item ==null)
    368.                         return;
    369.                 player.getPackets().sendGameMessage(ItemExamines.getExamine(item));
    370.         }
    371.  
    372.         publicvoid refreshShop(){
    373.                 for(Player player : viewingPlayers){
    374.                         sendStore(player);
    375.                         player.getPackets().sendIComponentSettings(620, 25, 0,
    376.                                         getStoreSize()*6, 1150);
    377.                 }
    378.         }
    379.  
    380.         publicint getStoreSize(){
    381.                 return mainStock.length
    382.                                 +(generalStock !=null? generalStock.length:0);
    383.         }
    384.  
    385.         publicvoid sendStore(Player player){
    386.                 Item[] stock =new Item[mainStock.length
    387.                                 +(generalStock !=null? generalStock.length:0)];
    388.                 System.arraycopy(mainStock, 0, stock, 0, mainStock.length);
    389.                 if(generalStock !=null)
    390.                         System.arraycopy(generalStock, 0, stock, mainStock.length,
    391.                                         generalStock.length);
    392.                 player.getPackets().sendItems(MAIN_STOCK_ITEMS_KEY, stock);
    393.         }
    394.        
    395.         publicvoid sendSellStore(Player player, Item[] inventory){
    396.                 Item[] stock =new Item[inventory.length+(generalStock !=null? generalStock.length:0)];
    397.                 System.arraycopy(inventory, 0, stock, 0, inventory.length);
    398.                 if(generalStock !=null)
    399.                         System.arraycopy(generalStock, 0, stock, inventory.length, generalStock.length);
    400.                 player.getPackets().sendItems(MAIN_STOCK_ITEMS_KEY, stock);
    401.         }
    402.  
    403.         /**
    404.          * Checks if the player is buying an item or selling it.
    405.          * @param player The player
    406.          * @param slotId The slot id
    407.          * @param amount The amount
    408.          */
    409.         publicvoid handleShop(Player player, int slotId, int amount){
    410.                 boolean isBuying = player.getTemporaryAttributtes().get("shop_buying")!=null;
    411.                 if(isBuying)
    412.                         buy(player, slotId, amount);
    413.                 else
    414.                         sell(player, slotId, amount);
    415.         }
    416.  
    417.         public Item[] getMainStock(){
    418.                 returnthis.mainStock;
    419.         }
    420.  
    421. }

    ButtonHandler.java

    Code: Java
    1. elseif(interfaceId ==1265){
    2.                         Shop shop =(Shop) player.getTemporaryAttributtes().get("Shop");
    3.                         if(shop ==null)
    4.                                 return;
    5.                         boolean isBuying = player.getTemporaryAttributtes().get("shop_buying")!=null;
    6.                         int amount =(int) player.getTemporaryAttributtes().get("amount_shop");
    7.                         if(componentId ==20){
    8.                                 if(packetId == WorldPacketsDecoder.ACTION_BUTTON1_PACKET)
    9.                                         shop.sendInfo(player, slotId, isBuying ? shop.getMainStock(): player.getInventory().getItems().getItems());
    10.                                 elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON2_PACKET)
    11.                                         shop.handleShop(player, slotId, 1);
    12.                                 elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON3_PACKET)
    13.                                         shop.handleShop(player, slotId, 5);
    14.                                 elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON4_PACKET)
    15.                                         shop.handleShop(player, slotId, 10);
    16.                                 elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON5_PACKET)
    17.                                         shop.handleShop(player, slotId, 50);
    18.                                 elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON9_PACKET)
    19.                                         shop.handleShop(player, slotId, 500);
    20.                                 elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON8_PACKET)
    21.                                         shop.sendExamine(player, slotId);
    22.                         }elseif(componentId ==201){
    23.                                 Integer slot =(Integer) player.getTemporaryAttributtes().get("ShopSelectedSlot");
    24.                                 if(slot ==null)
    25.                                         return;
    26.                                 if(isBuying)
    27.                                         shop.buy(player, slot, amount);
    28.                                 else
    29.                                         shop.sell(player, slotId, amount);
    30.                         }elseif(componentId ==208){//+5
    31.                                 player.getTemporaryAttributtes().put("amount_shop", amount +5);
    32.                                 player.getPackets().sendIComponentText(interfaceId, 67, String.valueOf(amount));
    33.                         }elseif(componentId ==15){
    34.                                 player.getTemporaryAttributtes().put("amount_shop", amount +1);
    35.                                 player.getPackets().sendIComponentText(interfaceId, 67, String.valueOf(amount));
    36.                         }elseif(componentId ==214){
    37.                                 player.getTemporaryAttributtes().put("amount_shop", amount -1);
    38.                                 player.getPackets().sendIComponentText(interfaceId, 67, String.valueOf(amount));
    39.                         }elseif(componentId ==15){
    40.                                 player.getTemporaryAttributtes().put("amount_shop", amount +5);
    41.                                 player.getPackets().sendIComponentText(interfaceId, 67, String.valueOf(amount));
    42.                         }elseif(componentId ==29){
    43.                                 player.getTemporaryAttributtes().remove("shop_buying");
    44.                         }elseif(componentId ==28){
    45.                                 player.getTemporaryAttributtes().put("shop_buying", true);
    46.                         }
    47.                 }elseif(interfaceId ==1266){
    48.                         if(componentId ==0){
    49.                                 if(packetId == WorldPacketsDecoder.ACTION_BUTTON9_PACKET)
    50.                                         player.getInventory().sendExamine(slotId);
    51.                                 else{
    52.                                         Shop shop =(Shop) player.getTemporaryAttributtes().get("Shop");
    53.                                         if(shop ==null)
    54.                                                 return;
    55.                                         if(packetId == WorldPacketsDecoder.ACTION_BUTTON1_PACKET)
    56.                                                 shop.sendValue(player, slotId);
    57.                                         elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON2_PACKET)
    58.                                                 shop.sell(player, slotId, 1);
    59.                                         elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON3_PACKET)
    60.                                                 shop.sell(player, slotId, 5);
    61.                                         elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON4_PACKET)
    62.                                                 shop.sell(player, slotId, 10);
    63.                                         elseif(packetId == WorldPacketsDecoder.ACTION_BUTTON5_PACKET)
    64.                                                 shop.sell(player, slotId, 50);
    65.                                 }
    66.                         }
    67.                 }
    68.  

    WorldsPacketDecoder.java Switch item packet

    Code: Java
    1.                                 if(fromInterfaceId ==1265&& toInterfaceId ==1266&& player.getTemporaryAttributtes().get("shop_buying")!=null){
    2.                                         Shop shop =(Shop) player.getTemporaryAttributtes().get("Shop");
    3.                                         if(shop ==null)
    4.                                                 return;
    5.                                         shop.buy(player, fromSlot, 1);
    6.                                 }
    7.  

    Quote:
    Originally Posted by I r Tom
    you fail harder then fat kids on bikes.:trollface:


    Offlineizaazk

    • Member
    • **
    • Posts: 14
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #1 on: July 17, 2012, 03:54:14 PM »
    SHABBA!!! WHY!!!! btw its me izaazkothawala from RuneServer...

    U just helped destroy the RSPS world by giving leechers the sole thing keeping them from directly hosting :(

    u shuda put an anti leech in there  ; )

    EDIT:

    This post just got 20+ Views no comments... DOES THAT TELL YA SUMTIN o.O :P
    « Last Edit: July 17, 2012, 04:01:06 PM by izaazk »

    Offlineshabba 56

    • Member
    • ****
    • Posts: 575
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #2 on: July 17, 2012, 11:07:32 PM »
    haha its not mine anyway :P raghav posted it so blame him xD
    Quote:
    Originally Posted by I r Tom
    you fail harder then fat kids on bikes.:trollface:


    OfflineTeam_Rocket

    • Member
    • ****
    • Posts: 3,774
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #3 on: July 18, 2012, 12:52:37 AM »
    This is a Snippet. The newbies who are using that Matrix base will probably be the only ones using this.
    I'm done, because you children really are hopeless.

    Offlinenarutas

    • Member
    • **
    • Posts: 34
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #4 on: July 18, 2012, 06:09:03 AM »
    Im sorry, but what do you mean by switch item packet ? Which one is it ?

    OfflineMephobia

    • Member
    • **
    • Posts: 10
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #5 on: July 18, 2012, 08:01:22 AM »
    Its fine leechers wont be able to use this unless they know how to utilize their imports.

    OfflineAshi

    • Member
    • ****
    • Posts: 3,585
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #6 on: July 18, 2012, 08:18:31 AM »
    This is wrong! :O

    works yeah... but it not the proper way! :(

    Offlinenarutas

    • Member
    • **
    • Posts: 34
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #7 on: July 18, 2012, 09:12:04 AM »
    Its fine leechers wont be able to use this unless they know how to utilize their imports.
    Look man, i just need a little bit of help, please? I mean i added the whole code and there were no errors, i just don't understand the switch item packet part, what exactly do i have to do? I tried google, but didn't find anything...

    Offlineshabba 56

    • Member
    • ****
    • Posts: 575
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #8 on: July 18, 2012, 02:31:42 PM »
    This is wrong! :O

    works yeah... but it not the proper way! :(

    lmfao i wouldn't give you full shops even if you payed for it be lucky he eve uploaded this or go learn more about java
    Quote:
    Originally Posted by I r Tom
    you fail harder then fat kids on bikes.:trollface:

    Offlinekingcobra805

    • Member
    • ****
    • Posts: 470
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #9 on: July 18, 2012, 10:03:30 PM »
    This is wrong! :O

    works yeah... but it not the proper way! :(

    lmfao i wouldn't give you full shops even if you payed for it be lucky he eve uploaded this or go learn more about java

    lol, full shops are not going to be just handed out any time soon i had to pay 20M Rsgp for just a fix with my shops lol.

    Fully Working now (:

    Offlineshabba 56

    • Member
    • ****
    • Posts: 575
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #10 on: July 19, 2012, 12:08:39 AM »
    This is wrong! :O

    works yeah... but it not the proper way! :(

    lmfao i wouldn't give you full shops even if you payed for it be lucky he eve uploaded this or go learn more about java

    lol, full shops are not going to be just handed out any time soon i had to pay 20M Rsgp for just a fix with my shops lol.

    Fully Working now (:

    its not hard to fix urself you just need to add the new shop id's and make a new buy and sell method
    Quote:
    Originally Posted by I r Tom
    you fail harder then fat kids on bikes.:trollface:

    Offlineizaazk

    • Member
    • **
    • Posts: 14
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #11 on: July 19, 2012, 01:04:59 AM »
    dont forget the price formula in WORLDSPACKETENCODER : P

    OfflineAshi

    • Member
    • ****
    • Posts: 3,585
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #12 on: July 19, 2012, 02:14:38 AM »
    This is wrong! :O

    works yeah... but it not the proper way! :(

    lmfao i wouldn't give you full shops even if you payed for it be lucky he eve uploaded this or go learn more about java

    I have full shops -.-"
     
    I was trying to say that this isnt the correct way to do it.

    Offlineshabba 56

    • Member
    • ****
    • Posts: 575
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #13 on: July 19, 2012, 03:06:30 AM »
    This is wrong! :O

    works yeah... but it not the proper way! :(

    lmfao i wouldn't give you full shops even if you payed for it be lucky he eve uploaded this or go learn more about java

    I have full shops -.-"
     
    I was trying to say that this isnt the correct way to do it.

    lol im sure u do
    Quote:
    Originally Posted by I r Tom
    you fail harder then fat kids on bikes.:trollface:

    OfflineVulcanic

    • Member
    • **
    • Posts: 32
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #14 on: July 19, 2012, 09:55:03 AM »
    Doesn't work guys, the real shops are so easy.. just saiyan.. if anyone wants to buy, pm me
    Vulcanic 667/718 Coming Soon!
    Join the forums and watch the development. Click dat link!
    http://www.vulcanicrsps.host-ed.me/

    Offlinelovakatt2

    • Member
    • **
    • Posts: 6
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #15 on: July 19, 2012, 02:09:51 PM »
    thx

    Offlineshabba 56

    • Member
    • ****
    • Posts: 575
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #16 on: July 19, 2012, 02:35:48 PM »
    Doesn't work guys, the real shops are so easy.. just saiyan.. if anyone wants to buy, pm me

    it does work u drag items into ur invo to buy them use it before posting silly comments
    Quote:
    Originally Posted by I r Tom
    you fail harder then fat kids on bikes.:trollface:

    Offlinenarutas

    • Member
    • **
    • Posts: 34
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #17 on: July 20, 2012, 03:38:42 AM »
    If you have trouble adding this, just replace your server files with these.
    Shop.java
    WorldPacketDecoders.java
    ButtonHandler.java :: Paste ID 58ce5b7162[/url]
    « Last Edit: July 21, 2012, 03:38:19 AM by narutas »

    OfflineClawz Own U

    • Member
    • ****
    • Posts: 307
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #18 on: July 28, 2012, 08:09:43 PM »
    Thanks!
    People I Respect -------> Ruby, Austin Cadle, TinyScape, Davidi2, MessyScape 562, TimeRS3, and Arcik!

    Offlinewrrion15

    • Member
    • **
    • Posts: 30
    • Thanks: +0/-0
      • View Profile
    Re: 718 shops fix
    « Reply #19 on: August 08, 2012, 12:12:48 PM »
    Thanks but i get 1 error...
    Code: [Select]
    src\com\rs\net\decoders\handlers\ButtonHandler.java:911: error: method sendInfo
    in class Shop cannot be applied to given types;
                                            shop.sendInfo(player, slotId, isBuying);

                                                ^
      required: Player,int,Item[]
      found: Player,int,boolean
      reason: actual argument boolean cannot be converted to Item[] by method invoca
    tion conversion
    1 error
    « Last Edit: August 08, 2012, 12:20:11 PM by wrrion15 »

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal