1package com.runehive.content.store.impl;
4import com.runehive.content.emote.Skillcape;
5import com.runehive.content.store.*;
6import com.runehive.content.store.currency.CurrencyType;
7import com.runehive.game.world.entity.mob.player.Player;
8import com.runehive.game.world.entity.skill.Skill;
9import com.runehive.game.world.items.Item;
10import com.runehive.game.world.items.containers.ItemContainer;
11import com.runehive.net.packet.out.SendItemOnInterface;
12import com.runehive.net.packet.out.SendScrollbar;
13import com.runehive.net.packet.out.SendString;
15import java.util.Arrays;
16import java.util.Objects;
18import static com.runehive.content.store.currency.CurrencyType.COINS;
32 Arrays.stream(
items).filter(Objects::nonNull).forEach(item ->
itemCache.put(item.getId(), item.getAmount()));
44 int amount = action == 2 ? 1 : action == 3 ? 10 : action == 4 ? 100 : -100;
46 throw new IllegalArgumentException(
"The action given was invalid. [ACTION=" + action +
"]");
60 player.
message(
"Something went wrong with your purchase!");
69 if (super.purchase(player, item,
slot)) {
Class to execute all constants for Shops.
static final int INTERFACE_ID
The identification for the shop itemcontainer.
void sendPurchaseValue(Player player, int slot)
final String name
The name of this shop.
Store(String name, ItemContainer.StackPolicy policy, CurrencyType currencyType, int capacity)
Map< Integer, Integer > itemCache
The map of cached shop item identifications and their amounts.
static Map< String, Store > STORES
A mapping of each shop by it's name.
final CurrencyType currencyType
The currency for this shop.
ItemContainer container
The current item container which contains the current items from this shop.
A simple wrapper class which holds extra attributes for the item object.
void refresh(Player player)
void itemContainerAction(Player player, int id, int slot, int action, boolean purchase)
void close(Player player)
boolean purchase(Player player, Item item, int slot)
final SkillManager skills
final GenericAttributes attributes
void openInventory(int identification, int overlay)
Opens an inventory interface for the player.
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
final InterfaceManager interfaceManager
void send(OutgoingPacket encoder)
Represents a trainable and usable skill.
static String getName(int skill)
Gets the name for a skill id.
static final int SKILL_COUNT
The amount of available skills.
int getMaxLevel(int id)
Gets the highest possible level of a skill.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
An abstraction game representing a group of Items.
final Item[] toArray()
Returns a shallow copy of the backing array.
void addOrDrop(List< Item > items)
Attempts to deposit an item to the players inventory, if there is no space it'll bank the item instea...
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
public< K > void remove(K key)
Removes a generic attribute.
public< K, E > void set(K key, E attribute)
Sets a generic attribute.
Holds the data for skillcape emotes.
static StoreItem[] getItems()
static Skillcape forId(int id)
Represents ways items can be sold in a shop.
NONE
No items can be sold in the shop.
The enumerated type whose elements represent constants that are used to differ between shops.
DEFAULT
The default shop which is commonly owned by the server.
The enumerated type whom holds all the currencies usable for a server.
static String getValue(Player player, CurrencyType currency)
An enumerated type defining policies for stackable Items.
ALWAYS
The ALWAYS policy, items are always stacked regardless of their ItemDefinition table.