Thread: [PI]Buy X

Page 1 of 7 123 ... LastLast
Results 1 to 10 of 69
  1. #1 [PI]Buy X 
    Registered Member Pakku's Avatar
    Join Date
    Mar 2010
    Posts
    1,234
    Thanks given
    127
    Thanks received
    111
    Rep Power
    47
    Client sideded: Change
    Code:
    rsInterface.itemActions[4] = "Buy 50";
    To
    Code:
    rsInterface.itemActions[4] = "Buy X";
    Server sided: In BankX1.java, replace:
    Code:
    		if (c.xInterfaceId == 3900) {
    			c.buyingX = true;
    			c.outStream.createFrame(27);
    			return;
    		}
    BankX2.java, add:
    Code:
    		if (c.buyingX) {
    			if (Xamount <= 1000) {
    				c.getShops().buyItem(c.xRemoveId, c.xRemoveSlot, Xamount);
    			} else {
    				c.sendMessage("You cannot buy more than 1000 at a time.");
    			}
    			c.xRemoveSlot = 0;
    			c.xInterfaceId = 0;
    			c.xRemoveId = 0;
    			c.buyingX = false;
    		}
    You can change the 1000 to whatever.

    Declare this in Player.java:
    Code:
    	public boolean buyingX;
    If you have any problems, post below.


    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    HEAD GFX DESIGNER

    Rusko's Avatar
    Join Date
    Aug 2010
    Posts
    3,316
    Thanks given
    645
    Thanks received
    1,199
    Rep Power
    5000
    Nice, thank you.
    Reply With Quote  
     

  4. #3  
    Banned

    Join Date
    Mar 2009
    Posts
    606
    Thanks given
    106
    Thanks received
    29
    Rep Power
    0
    thanks was released before but looks easier in this so I used will test ty
    Reply With Quote  
     

  5. #4  
    Banned

    Join Date
    Mar 2009
    Posts
    606
    Thanks given
    106
    Thanks received
    29
    Rep Power
    0
    doesn't even work
    Reply With Quote  
     

  6. #5  
    Registered Member Pakku's Avatar
    Join Date
    Mar 2010
    Posts
    1,234
    Thanks given
    127
    Thanks received
    111
    Rep Power
    47
    Quote Originally Posted by `Michael View Post
    doesn't even work
    What doesn't work? If it doesn't add items, you may need to modify your buyItem method.


    Reply With Quote  
     

  7. #6  
    Registered Member Sir raxim's Avatar
    Join Date
    Sep 2009
    Posts
    218
    Thanks given
    13
    Thanks received
    33
    Rep Power
    14
    You would have to modify the buyItem method and make it so if you're buying a large number of items, it won't loop through a single item, or else it'll take some time to buy the amount of items ,
    Reply With Quote  
     

  8. Thankful user:


  9. #7  
    Registered Member
    Join Date
    Dec 2010
    Age
    29
    Posts
    1,186
    Thanks given
    513
    Thanks received
    340
    Rep Power
    35
    Quote Originally Posted by Sir raxim View Post
    You would have to modify the buyItem method and make it so if you're buying a large number of items, it won't loop through a single item, or else it'll take some time to buy the amount of items ,
    Same with buying 100x, it's like that, it lags a little bit when you click Buy 100, and it doesn't buy the items in exactly 100 bulks, if you watch the shop after buying, you can see it go like 80, then 20, or 40, then 60 into your inv.
    Reply With Quote  
     

  10. #8  
    Registered Member
    Join Date
    Aug 2011
    Age
    27
    Posts
    10
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Hey, i need a little help...

    Spoiler for My BankX2:
    package server.model.players.packets;

    import server.model.players.Client;
    import server.model.players.PacketType;
    /**
    * Bank X Items
    **/
    public class BankX2 implements PacketType {
    @Override
    public void processPacket(Client c, int packetType, int packetSize) {
    int Xamount = c.getInStream().readDWord();
    if (Xamount == 0)
    Xamount = 1;
    switch(c.xInterfaceId) {
    case 5064:
    c.getItems().bankItem(c.playerItems[c.xRemoveSlot] , c.xRemoveSlot, Xamount);
    break;

    case 5382:
    c.getItems().fromBank(c.bankItems[c.xRemoveSlot] , c.xRemoveSlot, Xamount);
    break;

    case 3322:
    if(!c.getItems().playerHasItem(c.xRemoveId, Xamount))
    return;
    if (c.duelStatus <= 0) {
    if (Xamount > c.getItems().getItemAmount(c.xRemoveId))
    c.getTradeAndDuel().tradeItem(c.xRemoveId, c.xRemoveSlot,
    c.getItems().getItemAmount(c.xRemoveId));
    else
    c.getTradeAndDuel().tradeItem(c.xRemoveId, c.xRemoveSlot,
    Xamount);
    } else {
    if (Xamount > c.getItems().getItemAmount(c.xRemoveId))
    c.getTradeAndDuel().stakeItem(c.xRemoveId, c.xRemoveSlot,
    c.getItems().getItemAmount(c.xRemoveId));
    else
    c.getTradeAndDuel().stakeItem(c.xRemoveId, c.xRemoveSlot,
    Xamount);
    }
    break;

    case 3415:
    if(c.duelStatus <= 0) {
    c.getTradeAndDuel().fromTrade(c.xRemoveId, c.xRemoveSlot, Xamount);
    }
    break;

    case 6669:
    if(!c.getItems().playerHasItem(c.xRemoveId, Xamount))
    return;
    c.getTradeAndDuel().fromDuel(c.xRemoveId, c.xRemoveSlot, Xamount);
    break;

    }
    }
    }


    I dont know where to add

    Code:
    		if (c.buyingX) {
    			if (Xamount <= 1000) {
    				c.getShops().buyItem(c.xRemoveId, c.xRemoveSlot, Xamount);
    			} else {
    				c.sendMessage("You cannot buy more than 1000 at a time.");
    			}
    			c.xRemoveSlot = 0;
    			c.xInterfaceId = 0;
    			c.xRemoveId = 0;
    			c.buyingX = false;
    		}
    Could someone help me please?
    Reply With Quote  
     

  11. #9  
    Registered Member Pakku's Avatar
    Join Date
    Mar 2010
    Posts
    1,234
    Thanks given
    127
    Thanks received
    111
    Rep Power
    47
    Quote Originally Posted by Z-ro View Post
    this was already released
    I haven't found a working one yet.

    Quote Originally Posted by rebelz View Post
    Hey, i need a little help...

    Spoiler for My BankX2:
    package server.model.players.packets;

    import server.model.players.Client;
    import server.model.players.PacketType;
    /**
    * Bank X Items
    **/
    public class BankX2 implements PacketType {
    @Override
    public void processPacket(Client c, int packetType, int packetSize) {
    int Xamount = c.getInStream().readDWord();
    if (Xamount == 0)
    Xamount = 1;
    switch(c.xInterfaceId) {
    case 5064:
    c.getItems().bankItem(c.playerItems[c.xRemoveSlot] , c.xRemoveSlot, Xamount);
    break;

    case 5382:
    c.getItems().fromBank(c.bankItems[c.xRemoveSlot] , c.xRemoveSlot, Xamount);
    break;

    case 3322:
    if(!c.getItems().playerHasItem(c.xRemoveId, Xamount))
    return;
    if (c.duelStatus <= 0) {
    if (Xamount > c.getItems().getItemAmount(c.xRemoveId))
    c.getTradeAndDuel().tradeItem(c.xRemoveId, c.xRemoveSlot,
    c.getItems().getItemAmount(c.xRemoveId));
    else
    c.getTradeAndDuel().tradeItem(c.xRemoveId, c.xRemoveSlot,
    Xamount);
    } else {
    if (Xamount > c.getItems().getItemAmount(c.xRemoveId))
    c.getTradeAndDuel().stakeItem(c.xRemoveId, c.xRemoveSlot,
    c.getItems().getItemAmount(c.xRemoveId));
    else
    c.getTradeAndDuel().stakeItem(c.xRemoveId, c.xRemoveSlot,
    Xamount);
    }
    break;

    case 3415:
    if(c.duelStatus <= 0) {
    c.getTradeAndDuel().fromTrade(c.xRemoveId, c.xRemoveSlot, Xamount);
    }
    break;

    case 6669:
    if(!c.getItems().playerHasItem(c.xRemoveId, Xamount))
    return;
    c.getTradeAndDuel().fromDuel(c.xRemoveId, c.xRemoveSlot, Xamount);
    break;

    }
    }
    }


    I dont know where to add

    Code:
    		if (c.buyingX) {
    			if (Xamount <= 1000) {
    				c.getShops().buyItem(c.xRemoveId, c.xRemoveSlot, Xamount);
    			} else {
    				c.sendMessage("You cannot buy more than 1000 at a time.");
    			}
    			c.xRemoveSlot = 0;
    			c.xInterfaceId = 0;
    			c.xRemoveId = 0;
    			c.buyingX = false;
    		}
    Could someone help me please?
    Add it under
    Code:
    		if (Xamount == 0)
    			Xamount = 1;


    Reply With Quote  
     

  12. #10  
    [PI]Buy X



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    thanks for this release, now i can let my players buy out whole stock instead of sitting tediously buying 20 each time

    Attached image
    Reply With Quote  
     

Page 1 of 7 123 ... LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

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