RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ItemCurrency.java
1
package
com.osroyale.content.store.currency.impl;
2
3
import
com.osroyale.content.store.currency.Currency;
4
import
com.osroyale.game.world.entity.mob.player.Player;
5
import
com.osroyale.game.world.items.Item;
6
import
com.osroyale.game.world.items.ItemDefinition;
7
41
42
public
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
() {
79
return
ItemDefinition
.
get
(
itemId
).
getName
();
80
}
81
}
com.osroyale.content.store.currency.impl.ItemCurrency.canRecieveCurrency
boolean canRecieveCurrency(Player player)
Definition
ItemCurrency.java:73
com.osroyale.content.store.currency.impl.ItemCurrency.itemId
final int itemId
Definition
ItemCurrency.java:45
com.osroyale.content.store.currency.impl.ItemCurrency.recieveCurrency
void recieveCurrency(Player player, int amount)
Definition
ItemCurrency.java:63
com.osroyale.content.store.currency.impl.ItemCurrency.currencyAmount
int currencyAmount(Player player)
Definition
ItemCurrency.java:68
com.osroyale.content.store.currency.impl.ItemCurrency.tangible
boolean tangible()
Definition
ItemCurrency.java:53
com.osroyale.content.store.currency.impl.ItemCurrency.takeCurrency
boolean takeCurrency(Player player, int amount)
Definition
ItemCurrency.java:58
com.osroyale.content.store.currency.impl.ItemCurrency.toString
String toString()
Definition
ItemCurrency.java:78
com.osroyale.content.store.currency.impl.ItemCurrency.ItemCurrency
ItemCurrency(int itemId)
Definition
ItemCurrency.java:48
com.osroyale.game.world.entity.mob.player.Player
Definition
Player.java:162
com.osroyale.game.world.items.ItemDefinition
Definition
ItemDefinition.java:65
com.osroyale.game.world.items.ItemDefinition.getName
String getName()
Definition
ItemDefinition.java:713
com.osroyale.game.world.items.ItemDefinition.get
static ItemDefinition get(int id)
Definition
ItemDefinition.java:686
com.osroyale.game.world.items.containers.ItemContainer.add
boolean add(Item item)
Definition
ItemContainer.java:195
com.osroyale.game.world.items.containers.ItemContainer.contains
boolean contains(int id)
Definition
ItemContainer.java:757
com.osroyale.game.world.items.containers.ItemContainer.remove
boolean remove(Item item)
Definition
ItemContainer.java:348
com.osroyale.game.world.items.containers.ItemContainer.computeAmountForId
final int computeAmountForId(int id)
Definition
ItemContainer.java:579
com.osroyale.content.store.currency.Currency
Definition
Currency.java:11