Class ItemCollectorData
java.lang.Object
games.stendhal.server.maps.quests.logic.ItemCollectorData
- All Implemented Interfaces:
ItemCollectorSetters
Container for a collectible item. Holds information about the initial
required amount, as well as the current still needed amount, and a message
describing the need of the item. The recommended way of building an instance
of this type if by using
ItemCollector.require()
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSets the message to describe an item to collect.int
Gets the number of already collected items.Uses the configured message to describe the need of this item.getName()
Gets the name of the item to collect.int
Gets the number of initially required items.int
Gets the number of items that are still needed.Sets the name of an item to collect.pieces(int count)
Sets the number of required instances for an item to collect.void
Makes the still needed amount equal to the initial required amount.void
subtractAmount(int amount)
Subtract the specified amount from the still needed amount.void
subtractAmount(String amount)
Subtract the specified amount from the still needed amount.
-
Constructor Details
-
ItemCollectorData
public ItemCollectorData()
-
-
Method Details
-
item
Description copied from interface:ItemCollectorSetters
Sets the name of an item to collect.- Specified by:
item
in interfaceItemCollectorSetters
- Parameters:
itemName
- an item name- Returns:
- this object to allow method call chaining
-
pieces
Description copied from interface:ItemCollectorSetters
Sets the number of required instances for an item to collect.- Specified by:
pieces
in interfaceItemCollectorSetters
- Parameters:
count
- the number of items of the same kind- Returns:
- this object to allow method call chaining
-
bySaying
Description copied from interface:ItemCollectorSetters
Sets the message to describe an item to collect. Should contain a "%s" where the count and name of the item are to be replaced. For example, the message "I still need %s." may appear as "I still need 6 pieces of iron."- Specified by:
bySaying
in interfaceItemCollectorSetters
- Parameters:
message
- a message to be said by the NPC when talking about the item to collect- Returns:
- this object to allow method call chaining
-
subtractAmount
public void subtractAmount(int amount)Subtract the specified amount from the still needed amount.- Parameters:
amount
- how much to subtract from the still needed amount
-
subtractAmount
Subtract the specified amount from the still needed amount.- Parameters:
amount
- a number indicating how much to subtract from the still needed amount
-
resetAmount
public void resetAmount()Makes the still needed amount equal to the initial required amount. -
getAlreadyBrought
public int getAlreadyBrought()Gets the number of already collected items.- Returns:
- the difference between the initial required amount and the still needed amount
-
getStillNeeded
public int getStillNeeded()Gets the number of items that are still needed.- Returns:
- the difference between the initial required amount and the amount already brought
-
getRequiredAmount
public int getRequiredAmount()Gets the number of initially required items.- Returns:
- the number of initially required items
-
getName
Gets the name of the item to collect.- Returns:
- the name of the item to collect
-
getAnswer
Uses the configured message to describe the need of this item.- Returns:
- a message describing the need of this item.
- See Also:
bySaying(String)
-