Thread: Buying more than 1 item at a time from PKP shop

Results 1 to 3 of 3
  1. #1 Buying more than 1 item at a time from PKP shop 
    Registered Member
    Join Date
    Jun 2012
    Posts
    223
    Thanks given
    61
    Thanks received
    17
    Rep Power
    25
    Need to make it so I can buy more than 1 item at a time. Any help? Even if I push buy 100, it still takes cost of 1 let's say fire cape and only gives 1 fire cape.

    Code:
    	public void handleOtherShop(int itemID) {
    		if (c.myShopId == 8) {
    			if (c.pkp >= getSpecialItemValue(itemID)) {
    				if (c.getItems().freeSlots() > 0) {
    					c.pkp -= getSpecialItemValue(itemID);
    					c.getPA().loadQuests();
    					c.getItems().addItem(itemID, 1);
    					c.getItems().resetItems(3823);
    					c.getPA().sendFrame126(
    							"@whi@Pk Points: @gre@" + c.pkp + " ", 7333);
    				}
    			} else {
    				c.sendMessage("You do not have enough pk points to buy this item.");
    			}
    I know I need to change something with c.getItems().addItem(itemID, 1); but I'm not sure about what to put as itemAmount doesn't work. Any help?
    Reply With Quote  
     

  2. #2  
    ⚓Manic-Owner⚓


    Join Date
    Nov 2007
    Posts
    2,711
    Thanks given
    47
    Thanks received
    9
    Rep Power
    650
    pretty sure u gotta modify the buyitem method
    Reply With Quote  
     

  3. #3  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Quote Originally Posted by McG Rawest View Post
    pretty sure u gotta modify the buyitem method
    You're entirely right. The buyItem method parameters already support the concept of buying more than one of a certain item. The real problem is the 'handleOtherShop' method. You need to directly modify this method. It should look something along the lines of;

    Code:
    void handleOtherShop(int itemId, int itemAmount) {
        //check and see if the player has enough room
        
        //check if the player has enough currency for the amount they want to buy
    
        //increase amount given and currency taken away based on the cost * amount
    }
    Reply With Quote  
     

  4. Thankful user:



Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Replies: 3
    Last Post: 02-21-2015, 05:13 PM
  2. Replies: 2
    Last Post: 09-28-2014, 12:20 AM
  3. Replies: 4
    Last Post: 06-17-2013, 05:24 AM
  4. Replies: 10
    Last Post: 03-15-2009, 12:08 AM
  5. Buy/sell more than 10 at a time
    By Giovanni9104 in forum Tutorials
    Replies: 8
    Last Post: 08-30-2007, 04:07 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •