RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
RunecraftPouchData.java
1package com.osroyale.content.skill.impl.runecrafting;
2
3import com.osroyale.game.world.entity.mob.player.Player;
4
30
31public enum RunecraftPouchData {
32 SMALL_POUCH(5509, 1, 3, -1) {
33 @Override
34 public int deposit(Player player, int amount) {
35 if (player.smallPouch >= capacity) {
36 player.message("Your small pouch is already filled to it's capacity!");
37 return 0;
38 }
39
40 int essence = player.inventory.computeAmountForId(7936);
41
42 if (amount > essence)
43 amount = essence;
44
45 if (player.smallPouch + amount > capacity)
46 amount = capacity - player.smallPouch;
47
48 return player.smallPouch += amount;
49 }
50
51 @Override
52 public int withdraw(Player player) {
53 if (player.smallPouch == 0) {
54 player.message("You have no rune essences store in your small pouch!");
55 return 0;
56 }
57 if (player.inventory.getFreeSlots() < player.smallPouch){
58 player.message("Please free up some inventory spaces before doing this!");
59 return 0;
60 }
61 int amount = player.smallPouch;
62 empty(player);
63 return amount;
64 }
65
66 @Override
67 public void empty(Player player) {
68 player.smallPouch = 0;
69 }
70 },
71 MEDIUM_POUCH(5510, 25, 6, 9) {
72 public int deposit(Player player, int amount) {
73 if (player.mediumPouch >= capacity) {
74 player.message("Your medium pouch is already filled to it's capacity!");
75 return 0;
76 }
77
78 int essence = player.inventory.computeAmountForId(7936);
79
80 if (amount > essence)
81 amount = essence;
82
83 if (player.mediumPouch + amount > capacity)
84 amount = capacity - player.mediumPouch;
85
86 return player.mediumPouch += amount;
87 }
88
89 @Override
90 public int withdraw(Player player) {
91 if (player.mediumPouch == 0) {
92 player.message("You have no rune essences store in your medium pouch!");
93 return 0;
94 }
95 if (player.inventory.getFreeSlots() < player.mediumPouch){
96 player.message("Please free up some inventory spaces before doing this!");
97 return 0;
98 }
99 int amount = player.mediumPouch;
100 empty(player);
101 return amount;
102 }
103
104 @Override
105 public void empty(Player player) {
106 player.mediumPouch = 0;
107 }
108 },
109 LARGE_POUCH(5512, 50, 9, 18) {
110 public int deposit(Player player, int amount) {
111 if (player.largePouch >= capacity) {
112 player.message("Your large pouch is already filled to it's capacity!");
113 return 0;
114 }
115
116 int essence = player.inventory.computeAmountForId(7936);
117
118 if (amount > essence)
119 amount = essence;
120
121 if (player.largePouch + amount > capacity)
122 amount = capacity - player.largePouch;
123
124 return player.largePouch += amount;
125 }
126
127 @Override
128 public int withdraw(Player player) {
129 if (player.largePouch == 0) {
130 player.message("You have no rune essences store in your large pouch!");
131 return 0;
132 }
133 if (player.inventory.getFreeSlots() < player.largePouch){
134 player.message("Please free up some inventory spaces before doing this!");
135 return 0;
136 }
137 int amount = player.largePouch;
138 empty(player);
139 return amount;
140 }
141
142 @Override
143 public void empty(Player player) {
144 player.largePouch = 0;
145 }
146 },
147 GIANT_POUCH(5514, 75, 12, 50) {
148 public int deposit(Player player, int amount) {
149 if (player.giantPouch >= capacity) {
150 player.message("Your giant pouch is already filled to it's capacity!");
151 return 0;
152 }
153
154 int essence = player.inventory.computeAmountForId(7936);
155
156 if (amount > essence)
157 amount = essence;
158
159 if (player.giantPouch + amount > capacity)
160 amount = capacity - player.giantPouch;
161
162 return player.giantPouch += amount;
163 }
164
165 @Override
166 public int withdraw(Player player) {
167 if (player.giantPouch == 0) {
168 player.message("You have no rune essences store in your giant pouch!");
169 return 0;
170 }
171 if (player.inventory.getFreeSlots() < player.giantPouch){
172 player.message("Please free up some inventory spaces before doing this!");
173 return 0;
174 }
175 int amount = player.giantPouch;
176 empty(player);
177 return amount;
178 }
179
180 @Override
181 public void empty(Player player) {
182 player.giantPouch = 0;
183 }
184 };
185
187 public final int item;
188
190 public final int level;
191
193 public final int capacity;
194
196 public final int decay;
197
199 public abstract int deposit(Player player, int amount);
200
202 public abstract int withdraw(Player player);
203
205 public abstract void empty(Player player);
206
209 this.item = item;
210 this.level = level;
211 this.capacity = capacity;
212 this.decay = decay;
213 }
214
216 public static RunecraftPouchData forItem(int item) {
217 for (RunecraftPouchData pouch : values()) {
218 if (pouch.item == item)
219 return pouch;
220 }
221 return null;
222 }
223}
RunecraftPouchData(int item, int level, int capacity, int decay)