RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
RunecraftPouch.java
1package com.osroyale.content.skill.impl.runecrafting;
2
3import com.osroyale.game.world.entity.mob.player.Player;
4import com.osroyale.game.world.entity.skill.Skill;
5import com.osroyale.game.world.items.Item;
6
40
41public class RunecraftPouch {
43 private final Player player;
44
46 public RunecraftPouch(Player player) {
47 this.player = player;
48 }
49
51 public void deposit(RunecraftPouchData pouch) {
52 if (player.skills.getMaxLevel(Skill.RUNECRAFTING) < pouch.level) {
53 player.message("You need a runecrafting level of " + pouch.level + " to use this pouch!");
54 return;
55 }
56
57 int inventory = player.inventory.computeAmountForId(7936);
58
59 if (inventory == 0) {
60 player.message("You have no rune essences in your inventory to fill this pouch!");
61 return;
62 }
63
64 int essence = pouch.deposit(player, pouch.capacity);
65
66 System.out.println(essence);
67
68
69 if (essence != 0) {
70 player.inventory.remove(7936, essence);
71 player.message("You have filled your pouch with " + essence + " rune essences!");
72 }
73 }
74
76 public void withdraw(RunecraftPouchData pouch) {
77 int essence = pouch.withdraw(player);
78
79 if (essence != 0) {
80 player.inventory.add(7936, essence);
81 player.message("You have emptied your pouch.");
82 }
83 }
84
86 public boolean death(Item item) {
87 RunecraftPouchData pouch = RunecraftPouchData.forItem(item.getId());
88
89 if (pouch == null)
90 return false;
91
92 pouch.empty(player);
93 return true;
94 }
95}