Thread: 718 money pouch help matrix

Results 1 to 3 of 3
  1. #1 718 money pouch help matrix 
    Registered Member
    Join Date
    Aug 2014
    Posts
    108
    Thanks given
    22
    Thanks received
    0
    Rep Power
    11
    i have fixed it abit the only things that is not working is the add to pouch and withdraw help please

    Code:
    moneypouch.java
    --------------------
    package com.rs.game.player.content;
    
    import java.io.Serializable;
    import java.text.DecimalFormat;
    
    import com.rs.game.item.Item;
    import com.rs.game.player.Player;
    
    public class MoneyPouch implements Serializable {
    
    	private static final long serialVersionUID = -3847090682601697992L;
    
    	private transient Player player;
    	private boolean usingPouch;
    	private int coinAmount;
    
    	public MoneyPouch(Player player) {
    		this.player = player;
    	}
    
    	public void switchPouch() {
    		usingPouch = !usingPouch;
    		refresh(true);
    	}
    
    	private void refresh(boolean swap) {
    		if (swap)
    			player.getPackets().sendRunScript(5557, 1);
    		player.getPackets().sendRunScript(5560, coinAmount);
    	}
    
    	public void sendDynamicInteraction(int amount, boolean remove) {
    		int newAmount = remove ?  amount - coinAmount : amount + coinAmount;
    		Item item = new Item(995, amount - (remove ? 0 : Integer.MAX_VALUE));
    		if (remove) {
    			if (newAmount <= 0) {
    				if (player.getInventory().containsItem(item.getId(), item.getAmount())) 
    					player.getInventory().getItems().remove(item);
    				else
    					player.getPackets().sendGameMessage("You don't have enough coins.");
    				return;
    			} else
    				player.getPackets().sendGameMessage(getFormattedNumber(amount) +" coins have been removed from your money pouch.");
    		} else {
    			if (newAmount > Integer.MAX_VALUE) {
    				if (player.getInventory().getItems().add(item))
    					player.getPackets().sendGameMessage("Your money-pouch is currently full. Your coins will now go to your inventory.");
    				else
    					player.getPackets().sendGameMessage("Your inventory is currently full.");
    				return;
    			} else
    				player.getPackets().sendGameMessage(getFormattedNumber(amount) +" coins have been added to your money pouch.");
    		}
    		setAmount(newAmount, amount, remove);
    	}
    
    	private String getFormattedNumber(int amount) {
    		return new DecimalFormat("#,###,##0").format(amount).toString();
    	}
    
    	public void sendExamine() {
    		player.getPackets().sendGameMessage("Your money pouch current contains " + getFormattedNumber(coinAmount) + " coins.");
    	}
    
    	private void setAmount(int coinAmount, int addedAmount, boolean remove) {
    		this.coinAmount = coinAmount;
    		player.getPackets().sendRunScript(5561 , remove ? 0 : 1, addedAmount);
    		refresh(false);
    	}
    
    	public boolean isUsingPouch() {
    		return usingPouch;
    	}
    
    	public int getCoinsAmount() {
    		return coinAmount;
    	}
    } ]
    
    buttonhandler
    ------------------
    		[	} else if ((interfaceId == 746 && componentId == 207) || (interfaceId == 548 && componentId == 159)) {
    				if (packetId == WorldPacketsDecoder.ACTION_BUTTON1_PACKET) {
    					if (!player.getInterfaceManager().containsScreenInter()) {
    						player.getPackets().sendRunScript(5557, 1);
    						player.refreshMoneyPouch();
    					} else
    						player.getPackets().sendGameMessage("Please finish first with what your doing.");
    				} else if (packetId == WorldPacketsDecoder.ACTION_BUTTON2_PACKET){
    					player.getTemporaryAttributtes().put("remove_X_money", 995);
    					player.getTemporaryAttributtes().put("remove_money", Boolean.TRUE);
    					player.getPackets().sendRunScript(108, new Object[] { "                          Your money pouch contains " + player.money + " coins." + "                           How many would you like to withdraw?"});
    				} else if (packetId == WorldPacketsDecoder.ACTION_BUTTON3_PACKET){
    					player.getPackets().sendGameMessage("Your money pouch currently contains " + player.money + " coins.");
    				} else if (packetId == WorldPacketsDecoder.ACTION_BUTTON4_PACKET) {
    					if (player.getInterfaceManager().containsScreenInter()) {
    						player.getPackets()
    						.sendGameMessage(
    								"Please finish what you're doing before opening the price checker.");
    						return;
    					}
    					player.stopAll();
    					player.getPriceCheckManager().openPriceCheck();
    					}
    			}  ]
    
    more buttonhandler
    -----------------------
    		[	public void depositMoneyPouch(boolean banking) {
    					int coinsCount = player.getMoneyPouch().getCoinsAmount();
    					int space = addItems(new Item[] {new Item(955, coinsCount) }, banking);
    					if(space != 0) {
    						if (space < 1) {
    							player.getPackets().sendGameMessage("Not enough space in your bank.");
    							return;
    						}
    						player.getMoneyPouch().sendDynamicInteraction(coinsCount, true);
    					}
    				}       ]
    
    withdraw
    -----------------
     [  private MoneyPouch pouch;
    
    
     pouch = new MoneyPouch(this);
    
    
     public MoneyPouch getMoneyPouch() {
    		return pouch;
    	}
    Last edited by Streetwave; 09-20-2014 at 06:00 PM.
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2013
    Posts
    4,409
    Thanks given
    59
    Thanks received
    478
    Rep Power
    138
    Post what you have now.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Sep 2014
    Posts
    129
    Thanks given
    16
    Thanks received
    18
    Rep Power
    12
    you don't need to edit moneypouch.java for money pouch to work

    Edit; i can add it into matrix for you if you like, message me on rune-server for my skype.
    Reply With Quote  
     


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. 718 money pouch help
    By runescapersps1 in forum Help
    Replies: 5
    Last Post: 09-06-2014, 02:42 PM
  2. [718] Money Pouch HELP
    By PvM Hussain in forum Help
    Replies: 4
    Last Post: 09-05-2013, 04:20 PM
  3. [718] Money pouch + shop help?
    By Chaos105 in forum Help
    Replies: 0
    Last Post: 08-03-2013, 03:34 AM
  4. [718]Money Pouch help.
    By Chaos105 in forum Help
    Replies: 1
    Last Post: 05-07-2013, 01:57 PM
  5. [718/**] Money Pouch Help
    By Kayla in forum Help
    Replies: 13
    Last Post: 07-30-2012, 05:38 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
  •