RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ItemCurrency.java
1package com.osroyale.content.store.currency.impl;
2
3import com.osroyale.content.store.currency.Currency;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.game.world.items.Item;
6import com.osroyale.game.world.items.ItemDefinition;
7
41
42public final class ItemCurrency implements Currency {
43
45 public final int itemId;
46
48 public ItemCurrency(int itemId) {
49 this.itemId = itemId;
50 }
51
52 @Override
53 public boolean tangible() {
54 return true;
55 }
56
57 @Override
58 public boolean takeCurrency(Player player, int amount) {
59 return player.inventory.remove(new Item(itemId, amount));
60 }
61
62 @Override
63 public void recieveCurrency(Player player, int amount) {
64 player.inventory.add(new Item(itemId, amount));
65 }
66
67 @Override
68 public int currencyAmount(Player player) {
69 return player.inventory.computeAmountForId(itemId);
70 }
71
72 @Override
73 public boolean canRecieveCurrency(Player player) {
74 return player.inventory.contains(itemId);
75 }
76
77 @Override
78 public String toString() {
80 }
81}
boolean takeCurrency(Player player, int amount)