RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.store.StoreItem Class Reference

A simple wrapper class which holds extra attributes for the item object. More...

Inheritance diagram for com.runehive.content.store.StoreItem:
Collaboration diagram for com.runehive.content.store.StoreItem:

Public Member Functions

boolean canReduce ()
StoreItem copy ()
 A substitute for Object#clone() that creates another 'copy' of this instance.
CurrencyType getShopCurrency (Store store)
int getShopValue ()
void setCurrency (CurrencyType type)
void setShopValue (int value)
 StoreItem (int id, int amount)
 StoreItem (int id, int amount, int value)
 StoreItem (int id, int amount, OptionalInt value, Optional< CurrencyType > currency)
 Creates a new Item.
Public Member Functions inherited from com.runehive.game.world.items.Item
Item clone ()
Item createAndDecrement (int removeAmount)
 Creates a new item with amount - removeAmount and the same identifier.
Item createAndIncrement (int addAmount)
 Creates a new item with amount + addAmount and the same identifier.
Item createWithAmount (int newAmount)
 Creates a new item with newAmount and the same identifier as this instance.
Item createWithId (int newId)
 Creates a new item with newId and the same amount as this instance.
final void decrementAmount ()
 Decrements the amount by 1.
final void decrementAmountBy (int amount)
 Decrements the amount by amount @endiliteral.

boolean equalIds (Item other)
boolean equals (Object obj)
final int getAmount ()
 Gets the quantity of this item.
OptionalInt getAttackAnimation (FightType type)
int getBaseValue ()
OptionalInt getBlockAnimation ()
int getBonus (int index)
int[] getBonuses ()
ItemDefinition getDefinition ()
 Gets the item definition for the item identifier.
String getDestroyMessage ()
EquipmentType getEquipmentType ()
int getHighAlch ()
final int getId ()
 Gets the identification of this item.
int getLowAlch ()
String getName ()
int getNotedId ()
Optional< RangedWeaponDefinitiongetRangedDefinition ()
int[] getRequirements ()
int getRunAnimation ()
int getSellValue ()
int getStandAnimation ()
int getStreetValue ()
int getUnnotedId ()
int getValue ()
 Gets the value for this item.
int getValue (PriceType type)
 Gets the value for this item.
int getWalkAnimation ()
WeaponInterface getWeaponInterface ()
double getWeight ()
int hashCode ()
final void incrementAmount ()
 Increments the amount by 1.
final void incrementAmountBy (int amount)
 Increments the amount by amount.
boolean isDestroyable ()
boolean isEquipable ()
boolean isNoteable ()
boolean isNoted ()
boolean isStackable ()
boolean isTradeable ()
boolean isTwoHanded ()
 Item (int id)
 Creates a new Item with an quantity of 1.
 Item (int id, int amount)
 Creates a new Item.
 Item (int id, int minAmt, int maxAmt)
 Creates a new Item with a random amount between minAmt and maxAmt.
 Item (int id, long amount)
boolean matchesId (int id)
Item noted ()
 Gets the item note item.
final void setAmount (int amount)
 Sets the quantity of this item.
final void setId (int id)
 Sets the identification of this item.
final String toString ()
Item unnoted ()
 Gets the unnoted item.

Public Attributes

Optional< CurrencyTypecurrency = Optional.empty()
 Gets the optional currency for this shop item.
OptionalInt value = OptionalInt.empty()
 Gets the optional value for this shop item.

Static Public Attributes

static final int RESTOCK_RATE = 5
 The time in minutes an item in the store has to wait before it can be reduced.

Private Attributes

int restockTimer = RESTOCK_RATE
 The time in minutes it takes to restock this store item.

Additional Inherited Members

Static Public Member Functions inherited from com.runehive.game.world.items.Item
static final Item[] convert (int... id)
 Converts an int array into an Item array.
static final int[] convert (Item... ids)
 Converts an Item array into an Integer array.
static boolean valid (Item item)
 Determines if item is valid.

Detailed Description

A simple wrapper class which holds extra attributes for the item object.

Author
Stand Up
Since
4-1-2017.

Definition at line 15 of file StoreItem.java.

Constructor & Destructor Documentation

◆ StoreItem() [1/3]

com.runehive.content.store.StoreItem.StoreItem ( int id,
int amount,
OptionalInt value,
Optional< CurrencyType > currency )

Creates a new Item.

Definition at line 34 of file StoreItem.java.

34 {
35 super(id, amount);
36 this.value = value;
37 this.currency = currency;
38 }

References com.runehive.game.world.items.Item.amount, currency, and value.

Referenced by copy().

Here is the caller graph for this function:

◆ StoreItem() [2/3]

com.runehive.content.store.StoreItem.StoreItem ( int id,
int amount,
int value )

Definition at line 40 of file StoreItem.java.

40 {
41 this(id, amount, OptionalInt.of(value), Optional.of(CurrencyType.COINS));
42 }

References com.runehive.game.world.items.Item.amount, com.runehive.content.store.currency.CurrencyType.COINS, com.runehive.game.world.items.Item.id, and value.

◆ StoreItem() [3/3]

com.runehive.content.store.StoreItem.StoreItem ( int id,
int amount )

Definition at line 44 of file StoreItem.java.

44 {
45 this(id, amount, OptionalInt.empty(), Optional.empty());
46 }

References com.runehive.game.world.items.Item.amount, and com.runehive.game.world.items.Item.id.

Member Function Documentation

◆ canReduce()

boolean com.runehive.content.store.StoreItem.canReduce ( )

Definition at line 64 of file StoreItem.java.

64 {
65 if (--restockTimer <= 0) {
66 restockTimer = RESTOCK_RATE;
67 return true;
68 }
69 return false;
70 }

References RESTOCK_RATE, and restockTimer.

Referenced by com.runehive.content.store.impl.DefaultStore.StoreRestockTask.restock().

Here is the caller graph for this function:

◆ copy()

StoreItem com.runehive.content.store.StoreItem.copy ( )

A substitute for Object#clone() that creates another 'copy' of this instance.

The created copy safe meaning it does not hold any references to the original instance.

Returns
the copy of this instance that does not hold any references.

Reimplemented from com.runehive.game.world.items.Item.

Definition at line 73 of file StoreItem.java.

73 {
74 return new StoreItem(getId(), getAmount(), value, currency);
75 }

References currency, com.runehive.game.world.items.Item.getAmount(), com.runehive.game.world.items.Item.getId(), StoreItem(), and value.

Here is the call graph for this function:

◆ getShopCurrency()

CurrencyType com.runehive.content.store.StoreItem.getShopCurrency ( Store store)

Definition at line 56 of file StoreItem.java.

56 {
57 return currency.orElse(store.currencyType);
58 }

References currency.

Referenced by com.runehive.content.store.impl.PersonalStore.modify(), com.runehive.content.store.impl.DefaultStore.refresh(), and com.runehive.content.store.Store.sendPurchaseValue().

Here is the caller graph for this function:

◆ getShopValue()

int com.runehive.content.store.StoreItem.getShopValue ( )

Definition at line 48 of file StoreItem.java.

48 {
49 return value.orElse((int)((double)getValue() * 1.20));
50 }

References com.runehive.game.world.items.Item.getValue(), and value.

Referenced by com.runehive.content.store.Store.purchase(), com.runehive.content.store.impl.DefaultStore.refresh(), com.runehive.content.store.Store.sendPurchaseValue(), com.runehive.content.store.impl.PersonalStore.setValue(), and com.runehive.content.skill.impl.slayer.Slayer.store().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrency()

void com.runehive.content.store.StoreItem.setCurrency ( CurrencyType type)

Definition at line 60 of file StoreItem.java.

60 {
61 this.currency = currency;
62 }

References currency.

◆ setShopValue()

void com.runehive.content.store.StoreItem.setShopValue ( int value)

Definition at line 52 of file StoreItem.java.

52 {
53 this.value = OptionalInt.of(value);
54 }

References value.

Referenced by com.runehive.content.store.impl.PersonalStore.modify(), and com.runehive.content.store.impl.PersonalStore.setValue().

Here is the caller graph for this function:

Member Data Documentation

◆ currency

Optional<CurrencyType> com.runehive.content.store.StoreItem.currency = Optional.empty()

Gets the optional currency for this shop item.

Definition at line 26 of file StoreItem.java.

Referenced by copy(), getShopCurrency(), setCurrency(), and StoreItem().

◆ RESTOCK_RATE

final int com.runehive.content.store.StoreItem.RESTOCK_RATE = 5
static

The time in minutes an item in the store has to wait before it can be reduced.

Definition at line 20 of file StoreItem.java.

Referenced by canReduce().

◆ restockTimer

int com.runehive.content.store.StoreItem.restockTimer = RESTOCK_RATE
private

The time in minutes it takes to restock this store item.

Definition at line 31 of file StoreItem.java.

Referenced by canReduce().

◆ value

OptionalInt com.runehive.content.store.StoreItem.value = OptionalInt.empty()

Gets the optional value for this shop item.

Definition at line 23 of file StoreItem.java.

Referenced by copy(), getShopValue(), setShopValue(), StoreItem(), and StoreItem().


The documentation for this class was generated from the following file: