BarterShopState

public class BarterShopState

Class BarterShopState. Provides bartershopstate functionality for the Hytale server.

java.lang.Object > BarterShopState

Field Summary

file

final Path file

Field file.

document

final BsonDocument document

Field document.

extraInfo

final ExtraInfo extraInfo

Field extraInfo.

dateTime

final LocalDateTime dateTime

Field dateTime.

daysSinceEpoch

final long daysSinceEpoch

Field daysSinceEpoch.

currentCycle

final long currentCycle

Field currentCycle.

isTodayRestockDay

final boolean isTodayRestockDay

Field isTodayRestockDay.

nextRestockInstant

final Instant nextRestockInstant

Field nextRestockInstant.

state

final ShopInstanceState state

Field state.

interval

final RefreshInterval interval

Field interval.

nextRefresh

final Instant nextRefresh

Field nextRefresh.

success

final boolean success

Field success.

currentStock

private int[] currentStock

Field currentStock.

nextRefreshTime

private Instant nextRefreshTime

Field nextRefreshTime.

resolveSeed

private Long resolveSeed

Field resolveSeed.

slots

final TradeSlot[] slots

Field slots.

random

final Random random

Field random.

result

final List result

Field result.

trades

final BarterTrade[] trades

Field trades.

newStock

final int[] newStock

Field newStock.

Method Detail

initialize

static void initialize (@Nonnull final Path dataDirectory)

Method initialize.

Parameters:
@Nonnull final Path dataDirectory

get

static BarterShopState get ()

Method get.

load

static void load ()

Method load.

save

static void save ()

Method save.

shutdown

static void shutdown ()

Method shutdown.

calculateNextScheduledRestock

static Instant calculateNextScheduledRestock (@Nonnull final Instant gameTime, final int intervalDays, final int restockHour)

Method calculateNextScheduledRestock.

Parameters:
@Nonnull final Instant gameTime
final int intervalDays
final int restockHour

getOrCreateShopState

public ShopInstanceState getOrCreateShopState (final BarterShopAsset asset, @Nonnull final Instant gameTime)

Method getOrCreateShopState.

Parameters:
final BarterShopAsset asset
@Nonnull final Instant gameTime

checkRefresh

public void checkRefresh (final BarterShopAsset asset, @Nonnull final Instant gameTime)

Method checkRefresh.

Parameters:
final BarterShopAsset asset
@Nonnull final Instant gameTime

getStockArray

public int[] getStockArray (final BarterShopAsset asset, @Nonnull final Instant gameTime)

Method getStockArray.

Parameters:
final BarterShopAsset asset
@Nonnull final Instant gameTime

getResolvedTrades

public BarterTrade[] getResolvedTrades (final BarterShopAsset asset, @Nonnull final Instant gameTime)

Method getResolvedTrades.

Parameters:
final BarterShopAsset asset
@Nonnull final Instant gameTime

executeTrade

public boolean executeTrade (final BarterShopAsset asset, final int tradeIndex, final int quantity, @Nonnull final Instant gameTime)

Method executeTrade.

Parameters:
final BarterShopAsset asset
final int tradeIndex
final int quantity
@Nonnull final Instant gameTime

getCurrentStock

public int[] getCurrentStock ()

Method getCurrentStock.

getNextRefreshTime

public Instant getNextRefreshTime ()

Method getNextRefreshTime.

setNextRefreshTime

public void setNextRefreshTime (final Instant time)

Method setNextRefreshTime.

Parameters:
final Instant time

getResolveSeed

public Long getResolveSeed ()

Method getResolveSeed.

setResolveSeed

public void setResolveSeed (final Long seed)

Method setResolveSeed.

Parameters:
final Long seed

resolveTradeSlots

static BarterTrade[] resolveTradeSlots (@Nonnull final BarterShopAsset asset, final long seed)

Method resolveTradeSlots.

Parameters:
@Nonnull final BarterShopAsset asset
final long seed

resetStockAndResolve

public void resetStockAndResolve (@Nonnull final BarterShopAsset asset)

Method resetStockAndResolve.

Parameters:
@Nonnull final BarterShopAsset asset

resetStock

public void resetStock (final BarterShopAsset asset)

Method resetStock.

Parameters:
final BarterShopAsset asset

expandStockIfNeeded

public boolean expandStockIfNeeded (final BarterShopAsset asset)

Method expandStockIfNeeded.

Parameters:
final BarterShopAsset asset

hasStock

public boolean hasStock (final int tradeIndex, final int quantity)

Method hasStock.

Parameters:
final int tradeIndex
final int quantity

decrementStock

public boolean decrementStock (final int tradeIndex, final int quantity)

Method decrementStock.

Parameters:
final int tradeIndex
final int quantity

getStock

public int getStock (final int tradeIndex)

Method getStock.

Parameters:
final int tradeIndex