Jump to content
Existing user? Sign In

Sign In



Sign Up

[Elvarg / OSRSPK] Item on bank un-noting.


Sanity

Recommended Posts

I made a quick item on bank un-noting system that took me 5 minuites but i thought I should share.
Just copy and paste the below into the itemOnObject method inside of UseItemPacket class
For this to work you need to have defined that the item is noted in items.json

if (item.getDefinition().isNoted() && gameObject.getDefinition().getName().toLowerCase().contains("bank")) {
			int id = item.getDefinition().getNoteId();
			int amount = item.getAmount();
			if (player.getInventory().getFreeSlots() == 0) {
				player.getPacketSender().sendMessage("You don't have enough space in your inventory.");
				return;
			}
			if (amount > player.getInventory().getFreeSlots()) 
				amount = player.getInventory().getFreeSlots();
			player.getInventory().getById(item.getId()).decrementAmountBy(amount);
			player.getInventory().add(id,amount);
			player.getPacketSender().sendMessage("You withdraw " + (amount) + " " + item.getDefinition().getName() + (amount > 1 ? "s" : "") + ".");
		}
		if (!item.getDefinition().isNoted() && item.getDefinition().getNoteId() != -1 && gameObject.getDefinition().getName().toLowerCase().contains("bank")) {
			player.setDialogueOptions(new DialogueOptions() {

				@Override
				public void handleOption(Player player, int option) {
					switch (option) {
					case 1:
						int amount = player.getInventory().getAmount(item.getId());
						int id = item.getDefinition().getNoteId();
						player.getInventory().delete(item.getId(),amount);
						player.getInventory().add(id,amount);
						player.getPacketSender().sendInterfaceRemoval();
						break;
					case 2:
						player.getPacketSender().sendInterfaceRemoval();
						break;
					}
					
				}
				
			});
			DialogueManager.start(player, new Dialogue() {

				@Override
				public DialogueType type() {
					return DialogueType.OPTION;
				}

				@Override
				public DialogueExpression animation() {
					return null;
				}

				@Override
				public String[] dialogue() {
					return new String[] {"Note","Cancel"};
				}
				
			});
		}

3TueeA8.gif

UPDATED:
Can un-noted AND note using options :/

Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...
  • 1 month later...
  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Contact

[email protected]

astra.security

What is a RSPS?

A RSPS, also known as RuneScape private server, is an online game based on RuneScape, and controlled by independent individuals.

Popular RSPS Servers

Runewild Ikov RedemptionRSPS

Disclaimer

Runesuite is not affiliated with runescape, jagex in any way & exists solely for educational purposes.

×
×
  • Create New...