Interface IRoleTrader

  • All Superinterfaces:
    IRole

    public interface IRoleTrader
    extends IRole
    • Method Detail

      • setSellOption

        void setSellOption​(int slot,
                           IItemStack currency,
                           IItemStack currency2,
                           IItemStack sold)
        Parameters:
        slot - Slot number 0-17
        currency - Currency item
        currency2 - Currency item number two
        sold - Item to be sold by this npc
      • setSellOption

        void setSellOption​(int slot,
                           IItemStack currency,
                           IItemStack sold)
        Parameters:
        slot - Slot number 0-17
        currency - Currency item
        sold - Item to be sold by this npc
      • getSellOption

        IItemStack getSellOption​(int slot)
        Parameters:
        slot -
        Returns:
        The item being sold in this slot.
      • getCurrency

        IItemStack[] getCurrency​(int slot)
        Parameters:
        slot -
        Returns:
        a ScriptItemStack array of size 2 which contains the currency of this trade
      • removeSellOption

        void removeSellOption​(int slot)
        Parameters:
        slot - Slot number 0-17
      • setMarket

        void setMarket​(String name)
        Parameters:
        name - The trader Linked Market name
      • getMarket

        String getMarket()
        Returns:
        Get the currently set Linked Market name
      • getPurchaseNum

        int getPurchaseNum​(int slot)
        Parameters:
        slot -
        Returns:
        the number of times an item has been sold on that slot
      • getPurchaseNum

        int getPurchaseNum​(int slot,
                           IPlayer player)
        Parameters:
        slot -
        player -
        Returns:
        the number of times this player has purchased from this trader
      • resetPurchaseNum

        void resetPurchaseNum()
        Sets the purchase count of all slots to 0
      • resetPurchaseNum

        void resetPurchaseNum​(int slot)
        sets the purchase num for that slot to 0
        Parameters:
        slot -
      • resetPurchaseNum

        void resetPurchaseNum​(int slot,
                              IPlayer player)
        sets the purchase num for that slot and player to 0
        Parameters:
        slot -
        player -
      • isSlotEnabled

        boolean isSlotEnabled​(int slot)
        Parameters:
        slot -
        Returns:
        if this slot is enabled
      • isSlotEnabled

        boolean isSlotEnabled​(int slot,
                              IPlayer player)
        Parameters:
        slot -
        player -
        Returns:
        if this slot is enabled for this player
      • disableSlot

        void disableSlot​(int slot)
        prevent an item from being sold on that slot
        Parameters:
        slot -
      • disableSlot

        void disableSlot​(int slot,
                         IPlayer player)
        disables the slot for this player
        Parameters:
        slot -
        player -
      • enableSlot

        void enableSlot​(int slot)
        allow an item to be sold on that slot
        Parameters:
        slot -
      • enableSlot

        void enableSlot​(int slot,
                        IPlayer player)
        enables the slot for this player
        Parameters:
        slot -
        player -
      • isStockEnabled

        boolean isStockEnabled()
        Returns:
        Whether stock system is enabled
      • setStockEnabled

        void setStockEnabled​(boolean enabled)
        Enable or disable stock system
      • isPerPlayerStock

        boolean isPerPlayerStock()
        Returns:
        Whether stock is tracked per-player (true) or globally (false)
      • setPerPlayerStock

        void setPerPlayerStock​(boolean perPlayer)
        Set whether stock is per-player or global
      • getStockResetType

        int getStockResetType()
        Get the stock reset type
        Returns:
        0=NONE, 1=MCDAILY, 2=MCWEEKLY, 3=MCCUSTOM, 4=RLDAILY, 5=RLWEEKLY, 6=RLCUSTOM
      • setStockResetType

        void setStockResetType​(int type)
        Set stock reset type
        Parameters:
        type - 0=NONE, 1=MCDAILY, 2=MCWEEKLY, 3=MCCUSTOM, 4=RLDAILY, 5=RLWEEKLY, 6=RLCUSTOM
      • getCustomResetTime

        long getCustomResetTime()
        Get custom reset time (only used for MCCUSTOM/RLCUSTOM)
        Returns:
        Custom time in ticks (MC) or milliseconds (RL)
      • setCustomResetTime

        void setCustomResetTime​(long time)
        Set custom reset time
        Parameters:
        time - Time in ticks (MC) or milliseconds (RL)
      • getMaxStock

        int getMaxStock​(int slot)
        Get max stock for a slot
        Parameters:
        slot - Slot number 0-17
        Returns:
        Max stock, -1 = unlimited
      • setMaxStock

        void setMaxStock​(int slot,
                         int amount)
        Set max stock for a slot
        Parameters:
        slot - Slot number 0-17
        amount - Max stock, -1 = unlimited
      • getAvailableStock

        int getAvailableStock​(int slot)
        Get available stock for a slot (global mode)
        Parameters:
        slot - Slot number 0-17
        Returns:
        Available stock, Integer.MAX_VALUE if unlimited
      • getAvailableStock

        int getAvailableStock​(int slot,
                              IPlayer player)
        Get available stock for a slot for a specific player (per-player mode)
        Parameters:
        slot - Slot number 0-17
        player - The player
        Returns:
        Available stock, Integer.MAX_VALUE if unlimited
      • resetStock

        void resetStock()
        Reset all stock to max values
      • resetCooldown

        void resetCooldown()
        Reset the cooldown timer without resetting stock values Stock will reset on next trigger after this is called
      • getCurrentStock

        int getCurrentStock​(int slot)
        Get current stock for a slot (global mode)
        Parameters:
        slot - Slot number 0-17
        Returns:
        Current stock, -1 if not initialized
      • setCurrentStock

        void setCurrentStock​(int slot,
                             int amount)
        Set current stock for a slot (global mode only)
        Parameters:
        slot - Slot number 0-17
        amount - Current stock amount
      • getPlayerPurchased

        int getPlayerPurchased​(int slot,
                               IPlayer player)
        Get purchased amount for a player in a slot (per-player mode)
        Parameters:
        slot - Slot number 0-17
        player - The player
        Returns:
        Purchased amount (stock available = maxStock - purchasedAmount)
      • setPlayerPurchased

        void setPlayerPurchased​(int slot,
                                IPlayer player,
                                int amount)
        Set purchased amount for a player in a slot (per-player mode)
        Parameters:
        slot - Slot number 0-17
        player - The player
        amount - Purchased amount
      • getLastResetTime

        long getLastResetTime()
        Get the timestamp of the last stock reset
        Returns:
        Time in ticks (MC) or milliseconds (RL), depending on reset type
      • getTimeUntilReset

        long getTimeUntilReset()
        Get time remaining until next stock reset
        Returns:
        Time remaining in ticks (MC) or milliseconds (RL), -1 if no reset scheduled
      • getCurrencyCost

        long getCurrencyCost​(int slot)
        Get the currency cost for a slot (additive to item costs)
        Parameters:
        slot - Slot number 0-17
        Returns:
        Currency cost, 0 = no cost
      • setCurrencyCost

        void setCurrencyCost​(int slot,
                             long cost)
        Set the currency cost for a slot (additive to item costs)
        Parameters:
        slot - Slot number 0-17
        cost - Currency cost, 0 = no cost
      • hasCurrencyCost

        boolean hasCurrencyCost​(int slot)
        Parameters:
        slot - Slot number 0-17
        Returns:
        Whether this slot has a currency cost > 0