Players can now cut down jungle bushes while wielding a machete
Added inEquipmentOrInventory function to content API
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package content.region.karamja.handlers
|
||||
|
||||
import core.api.inEquipmentOrInventory
|
||||
import core.api.inInventory
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.scenery.SceneryBuilder
|
||||
import core.game.node.entity.player.Player
|
||||
@@ -47,11 +49,11 @@ class JungleBushHandler : InteractionListener {
|
||||
|
||||
}
|
||||
|
||||
fun checkRequirement(player: Player): Boolean{
|
||||
private fun checkRequirement(player: Player): Boolean{
|
||||
val machete = Item(Items.MACHETE_975)
|
||||
val jade_machete = Item(Items.JADE_MACHETE_6315)
|
||||
val opal_machete = Item(Items.OPAL_MACHETE_6313)
|
||||
val red_topaz_machete = Item(Items.RED_TOPAZ_MACHETE_6317)
|
||||
return player.inventory.containsItem(machete) || player.inventory.containsItem(jade_machete) || player.inventory.containsItem(opal_machete) || player.inventory.containsItem(red_topaz_machete)
|
||||
return inEquipmentOrInventory(player, machete.id) || inEquipmentOrInventory(player, jade_machete.id) || inEquipmentOrInventory(player, opal_machete.id) || inEquipmentOrInventory(player, red_topaz_machete.id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,6 +330,17 @@ fun inEquipment(player: Player, item: Int, amount: Int = 1): Boolean {
|
||||
return player.equipment.contains(item, amount)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an item exists in a player's equipment or inventory
|
||||
* @param player the player whose equipment to check
|
||||
* @param item the ID of the item to check for
|
||||
* @param amount the amount to check for, defaults to 1
|
||||
* @return true if the item exists in the given amount in the player's equipment or inventory
|
||||
*/
|
||||
fun inEquipmentOrInventory(player: Player, item: Int, amount: Int = 1): Boolean {
|
||||
return inInventory(player, item, amount) || inEquipment(player, item, amount)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of free slots in a player's inventory
|
||||
* @param player the player to check
|
||||
|
||||
Reference in New Issue
Block a user