Thread: money pouch question

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 money pouch question 
    Registered Member
    Join Date
    Feb 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Hello, I was wondering how to add 1mil, 1bil, 1Q, 1T notes to the money pouch, and how to withdraw them? Ive been coming through the forums but have not seen a guide about it.

    I already have the notes in-game. just need to learn how to add them to the pouch as currency, and remove them as such.
    thank you in advance
    Reply With Quote  
     

  2. #2  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    149
    Thanks given
    32
    Thanks received
    14
    Rep Power
    0
    Quote Originally Posted by lifesember View Post
    Hello, I was wondering how to add 1mil, 1bil, 1Q, 1T notes to the money pouch, and how to withdraw them? Ive been coming through the forums but have not seen a guide about it.

    I already have the notes in-game. just need to learn how to add them to the pouch as currency, and remove them as such.
    thank you in advance
    I believe many custom servers releaased in the downloads section already have this? so just download and rip?
    Reply With Quote  
     

  3. #3  
    Software Engineer

    OogleBoogle's Avatar
    Join Date
    Apr 2012
    Age
    22
    Posts
    3,881
    Thanks given
    575
    Thanks received
    488
    Discord
    View profile
    Rep Power
    266
    Just change it from the item id '995' to the tickets id?
    ╠╬╣
    ╦╦
    ╠╬╬╬╣
    ╠╬╬╬╬╬╬╣
    ╠╬╬╬╬╬╬╣
    ╚╩╩╩╩╩╩╝
    ╠╬╬╬╣

    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Feb 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    i want to still have GP in the server. so replacing it wont work.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Optimum's Avatar
    Join Date
    Apr 2012
    Posts
    3,517
    Thanks given
    830
    Thanks received
    1,580
    Discord
    View profile
    Rep Power
    5000
    just add b next too it?

    Quote Originally Posted by DownGrade View Post
    Don't let these no life creeps get to you, its always the same on here. They'd rather spend hours upon hours in the rune-server spam section then getting laid! ha ha!Its honestly pathetic i haven't seen so many lowlifes in my life its actually insane i wish that this section would just vanish its probably the only way to get these people out of the community...
    PLEASE BE AWARE OF IMPOSTERS MY DISCORD ID: 362240000760348683
    Reply With Quote  
     

  6. #6  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    149
    Thanks given
    32
    Thanks received
    14
    Rep Power
    0
    you don't need to replace the code for how coins work, make a new case for the tickets....


    can you show the code for how coins are added to your money pouch..
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Feb 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Code:
    	public static boolean depositMoney(Player plr, int amount) {
    		if(amount <= 0)
    			return false;
    		if(plr.getInterfaceId() > 0) {
    			plr.getPacketSender().sendMessage("Please close the interface you have open before opening another one.");
    			return false;
    		}
    		if(plr.getConstitution() <= 0) {
    			plr.getPacketSender().sendMessage("You cannot do this while dying.");
    			return false;
    		}
    		if(plr.getLocation() == Location.WILDERNESS) {
    			plr.getPacketSender().sendMessage("You cannot do this here.");
    			return false;
    		}
    		if (validateAmount(plr, amount)) {
    			long addedMoney = (long)plr.getMoneyInPouch() + (long)amount;
    			if (addedMoney > Long.MAX_VALUE) {
    				long canStore = Long.MAX_VALUE - plr.getMoneyInPouch();
    				plr.getInventory().delete(995, (int)canStore);
    				plr.setMoneyInPouch(plr.getMoneyInPouch() + canStore);
    				plr.getPacketSender().sendString(8135, ""+plr.getMoneyInPouch());
    				plr.getPacketSender().sendMessage("You've added "+canStore + " coins to your money pouch.");
    				return true;
    			} else {
    				plr.getInventory().delete(995, amount);
    				plr.setMoneyInPouch(plr.getMoneyInPouch() + amount);
    				plr.getPacketSender().sendString(8135, ""+plr.getMoneyInPouch());
    				plr.getPacketSender().sendMessage("You've added "+amount+" coins to your money pouch.");
    				return true;
    			}
    		} else {
    			plr.getPacketSender().sendMessage("You do not seem to have " +amount+" coins in your inventory.");
    			return false;
    		}
    	}


    Code:
    	public static boolean withdrawMoney(Player plr, long amount) {
    		if(amount <= 0)
    			return false;
    		if(plr.getMoneyInPouch() <= 0) {
    			plr.getPacketSender().sendMessage("Your money pouch is empty.");
    			return false;
    		}
    		boolean allowWithdraw = plr.getTrading().inTrade() || plr.getDueling().inDuelScreen;
    		if(!allowWithdraw) {
    			if(plr.getInterfaceId() > 0) {
    				plr.getPacketSender().sendMessage("Please close the interface you have open before opening another one.");
    				return false;
    			}
    			plr.getPacketSender().sendInterfaceRemoval();
    		}
    		if(amount > plr.getMoneyInPouch()/1000000000)
    			amount = plr.getMoneyInPouch()/1000000000;
    		if ((plr.getInventory().getAmount(909) + amount) < Integer.MAX_VALUE) {
    			plr.setMoneyInPouch(plr.getMoneyInPouch() - amount*1000000000);
    			plr.getInventory().add(909, (int) amount);
    			plr.getPacketSender().sendString(8135, ""+plr.getMoneyInPouch());
    			plr.getPacketSender().sendMessage("You withdraw "+amount+" M from your pouch.");
    			if(allowWithdraw)
    				plr.getPacketSender().sendItemContainer(plr.getInventory(), 3322);
    			return true;
    		} else if((plr.getInventory().getAmount(995) + amount) > Integer.MAX_VALUE) {
    			int canWithdraw = (Integer.MAX_VALUE - plr.getInventory().getAmount(995));
    			if(canWithdraw == 0) {
    				plr.getPacketSender().sendMessage("You cannot withdraw more money into your inventory.");
    				return false;
    			}
    			plr.setMoneyInPouch(plr.getMoneyInPouch() - canWithdraw);
    			plr.getInventory().add(995, canWithdraw);
    			plr.getPacketSender().sendString(8135, ""+plr.getMoneyInPouch());
    			plr.getPacketSender().sendMessage("You could only withdraw "+canWithdraw+" coins.");
    			if(allowWithdraw)
    				plr.getPacketSender().sendItemContainer(plr.getInventory(), 3322);
    			return true;
    		}
    		return false; 
    	}
    Code:
    	private static boolean validateAmount(Player plr, int amount) {
    		return plr.getInventory().getAmount(995) >= amount;
    	}
    
    }
    when withdrawing money, I need 1b or more in the moneypouch to withdraw anything. if I have anything less than 1b I receive the message "you withdraw 0 M from your pouch

    I tried placing 20B in the moneypouch and tried to withdraw 1 and tried 1b it gives me everything in the pouch down to 1M gp, and gives me 2x GS coin wich is the itemid 909 from above


    if I add the 2x gs coin to the money pouch, it only adds "2" to the pouch, assuming its 2 gp as I cant withdraw it without seeing the 0 m from your pouch message
    Reply With Quote  
     

  8. #8  
    Perplexity owner

    Join Date
    Feb 2011
    Posts
    149
    Thanks given
    32
    Thanks received
    14
    Rep Power
    0
    In your itemactionpacketlistener.java you need to set what the item should do, I imagine you have some code in there for adding coins to the pouch?

    you will want your first action to be something like
    Code:
    		if(itemId == 909) {//item id of custom currency
    			player.getInventory().delete(909,1);//custom currency to delete from inventory
    			player.getInventory().add(995,1000000000);//add the equivalent value of coins
    		}
    then you will need to give id 909 a second or third click action to add it to your pouch

    Code:
    case 995:
    			MoneyPouch.depositMoney(player, player.getInventory().getAmount(995));
    			break;
    			case 909:
    				int amount = 0;
    				for(int i = 0; i < player.getInventory().getAmount(909); i++) {
    					amount++;
    				}
    				player.getInventory().delete(909,amount);
    				player.setMoneyInPouch(player.getMoneyInPouch()+(long)1000000000*amount);
    				player.getPacketSender().sendString(8135, ""+player.getMoneyInPouch());
    				break;
    that code will cause lagg if you try to add a huge amount to the money pouch at once though
    Last edited by Perplexity; 06-20-2020 at 05:28 PM.
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Apr 2020
    Posts
    32
    Thanks given
    1
    Thanks received
    5
    Rep Power
    42
    Code:
    				int amount = 0;
    				for(int i = 0; i < player.getInventory().getAmount(909); i++) {
    					amount++;
    				}
    				player.getInventory().delete(909,amount);
    Why would you do that. Terrible way of doing something.
    Should be done like the following 2 examples.

    Code:
    				int amount = player.getInventory().getAmount(909);
    				player.getInventory().delete(909,amount);
    				player.setMoneyInPouch(player.getMoneyInPouch()+(long)1000000000*amount);
    				player.getPacketSender().sendString(8135, ""+player.getMoneyInPouch());
    				break;
    Or even

    Code:
    				Item item = player.getInventory().getItem(909);
    				If (item == null) {
    					break;
    				}
    				int amount = item.getAmount();
    				player.getInventory().delete(item);
    				player.setMoneyInPouch(player.getMoneyInPouch()+(long)1000000000*amount);
    				player.getPacketSender().sendString(8135, ""+player.getMoneyInPouch());
    				break;
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Feb 2014
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    I didn't do any of that, its how the source im using is setup...the souce is kind of a mess but I like a lot of the features on it so im trying my best to clean it up and get it running

    Im trying to fix / setup the moneypouch to do the following:

    -if you withdraw under 1b, it withdraws 1-999m gp.

    -If you withdraw over 1b, it withdraws 1b tickets/notes.

    -Increase "storage" amount in the pouch to be 1T or 1Q instead of default max-cash limit.


    any help with the moneypouch problem is greatly appreciated as ive still got a ways to go with other issues as well.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. Money Pouch - 99%
    By TheLife in forum Tutorials
    Replies: 142
    Last Post: 12-21-2015, 11:47 AM
  2. Replies: 7
    Last Post: 12-27-2013, 08:33 PM
  3. [PI] Money Pouch Problem
    By Gr1nderscape in forum Help
    Replies: 6
    Last Post: 01-06-2012, 08:57 AM
  4. Help me Dementhium Money Pouch
    By A Thugz Life in forum Help
    Replies: 2
    Last Post: 01-06-2012, 02:48 AM
  5. Money pouch problem
    By Gr1nderscape in forum Help
    Replies: 2
    Last Post: 12-17-2011, 06:26 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •